diff --git a/DEPS b/DEPS index a115f0a..38f1e6a 100644 --- a/DEPS +++ b/DEPS
@@ -67,7 +67,7 @@ # Three lines of non-changing comments so that # the commit queue can handle CLs rolling V8 # and whatever else without interference from each other. - 'v8_revision': 'cf2d43e8ea44e78f1937e115d2b6ed59730df3ac', + 'v8_revision': '7faf1aa95d25774c40942b407c8164935d79122a', # Three lines of non-changing comments so that # the commit queue can handle CLs rolling swarming_client # and whatever else without interference from each other. @@ -600,7 +600,7 @@ Var('chromium_git') + '/external/khronosgroup/webgl.git' + '@' + '34842fa3c36988840c89f5bc6a68503175acf7d9', 'src/third_party/webrtc': - Var('webrtc_git') + '/src.git' + '@' + 'd65ae4a8ba50a327e2aa84619fa19207bdc34e3f', # commit position 20165 + Var('webrtc_git') + '/src.git' + '@' + '59ff0e216b2736c2d002d94b9230ec7a918a5bda', # commit position 20165 'src/third_party/xdg-utils': { 'url': Var('chromium_git') + '/chromium/deps/xdg-utils.git' + '@' + 'd80274d5869b17b8c9067a1022e4416ee7ed5e0d',
diff --git a/ash/accelerators/accelerator_controller.cc b/ash/accelerators/accelerator_controller.cc index a83160e0..43fd580e 100644 --- a/ash/accelerators/accelerator_controller.cc +++ b/ash/accelerators/accelerator_controller.cc
@@ -373,7 +373,7 @@ ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); active_window->layer()->GetAnimator()->StartAnimation( new ui::LayerAnimationSequence( - base::MakeUnique<WindowRotation>(360, active_window->layer()))); + std::make_unique<WindowRotation>(360, active_window->layer()))); } void HandleShowKeyboardOverlay() {
diff --git a/ash/accelerators/accelerator_controller_delegate_classic.cc b/ash/accelerators/accelerator_controller_delegate_classic.cc index 7934246..dbeb4f0 100644 --- a/ash/accelerators/accelerator_controller_delegate_classic.cc +++ b/ash/accelerators/accelerator_controller_delegate_classic.cc
@@ -6,6 +6,7 @@ #include <algorithm> #include <cmath> +#include <memory> #include <string> #include <utility> @@ -26,7 +27,6 @@ #include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "ash/wm/window_state.h" #include "ash/wm/wm_event.h" -#include "base/memory/ptr_util.h" #include "base/metrics/histogram_macros.h" #include "base/metrics/user_metrics.h" #include "base/sys_info.h"
diff --git a/ash/accelerators/ash_focus_manager_factory.cc b/ash/accelerators/ash_focus_manager_factory.cc index b22c9a9f..5534694 100644 --- a/ash/accelerators/ash_focus_manager_factory.cc +++ b/ash/accelerators/ash_focus_manager_factory.cc
@@ -4,9 +4,10 @@ #include "ash/accelerators/ash_focus_manager_factory.h" +#include <memory> + #include "ash/accelerators/accelerator_controller.h" #include "ash/shell.h" -#include "base/memory/ptr_util.h" #include "ui/views/focus/focus_manager.h" namespace ash { @@ -17,8 +18,8 @@ std::unique_ptr<views::FocusManager> AshFocusManagerFactory::CreateFocusManager( views::Widget* widget, bool desktop_widget) { - return base::MakeUnique<views::FocusManager>( - widget, desktop_widget ? nullptr : base::MakeUnique<Delegate>()); + return std::make_unique<views::FocusManager>( + widget, desktop_widget ? nullptr : std::make_unique<Delegate>()); } AshFocusManagerFactory::Delegate::Delegate() {}
diff --git a/ash/accelerators/exit_warning_handler.cc b/ash/accelerators/exit_warning_handler.cc index cdf1ff6..53b2f9f 100644 --- a/ash/accelerators/exit_warning_handler.cc +++ b/ash/accelerators/exit_warning_handler.cc
@@ -4,11 +4,12 @@ #include "ash/accelerators/exit_warning_handler.h" +#include <memory> + #include "ash/public/cpp/shell_window_ids.h" #include "ash/session/session_controller.h" #include "ash/shell.h" #include "ash/strings/grit/ash_strings.h" -#include "base/memory/ptr_util.h" #include "base/metrics/user_metrics.h" #include "base/strings/utf_string_conversions.h" #include "base/time/time.h" @@ -153,7 +154,7 @@ params.name = "ExitWarningWindow"; params.parent = root_window->GetChildById(kShellWindowId_SettingBubbleContainer); - widget_ = base::MakeUnique<views::Widget>(); + widget_ = std::make_unique<views::Widget>(); widget_->Init(params); widget_->Show();
diff --git a/ash/accessibility/accessibility_controller.cc b/ash/accessibility/accessibility_controller.cc index 843ce75a..3043007 100644 --- a/ash/accessibility/accessibility_controller.cc +++ b/ash/accessibility/accessibility_controller.cc
@@ -4,6 +4,8 @@ #include "ash/accessibility/accessibility_controller.h" +#include <memory> + #include "ash/high_contrast/high_contrast_controller.h" #include "ash/public/cpp/ash_pref_names.h" #include "ash/public/cpp/config.h" @@ -115,7 +117,7 @@ void AccessibilityController::ObservePrefs(PrefService* prefs) { // Watch for pref updates from webui settings and policy. - pref_change_registrar_ = base::MakeUnique<PrefChangeRegistrar>(); + pref_change_registrar_ = std::make_unique<PrefChangeRegistrar>(); pref_change_registrar_->Init(prefs); pref_change_registrar_->Add( prefs::kAccessibilityLargeCursorEnabled,
diff --git a/ash/accessibility/accessibility_focus_ring_controller.cc b/ash/accessibility/accessibility_focus_ring_controller.cc index 8816943..448b23f 100644 --- a/ash/accessibility/accessibility_focus_ring_controller.cc +++ b/ash/accessibility/accessibility_focus_ring_controller.cc
@@ -7,10 +7,10 @@ #include <stddef.h> #include <algorithm> +#include <memory> #include "ash/accessibility/focus_ring_layer.h" #include "base/logging.h" -#include "base/memory/ptr_util.h" namespace ash { @@ -113,7 +113,7 @@ for (size_t i = 0; i < focus_rings_.size(); ++i) { if (!focus_layers_[i]) - focus_layers_[i] = base::MakeUnique<AccessibilityFocusRingLayer>(this); + focus_layers_[i] = std::make_unique<AccessibilityFocusRingLayer>(this); } if (focus_ring_behavior_ == PERSIST_FOCUS_RING &&
diff --git a/ash/app_list/app_list_presenter_delegate_factory.cc b/ash/app_list/app_list_presenter_delegate_factory.cc index e8275b1..57068f2 100644 --- a/ash/app_list/app_list_presenter_delegate_factory.cc +++ b/ash/app_list/app_list_presenter_delegate_factory.cc
@@ -4,8 +4,9 @@ #include "ash/app_list/app_list_presenter_delegate_factory.h" +#include <memory> + #include "ash/app_list/app_list_presenter_delegate.h" -#include "base/memory/ptr_util.h" #include "ui/app_list/presenter/app_list_view_delegate_factory.h" namespace ash { @@ -19,7 +20,7 @@ std::unique_ptr<app_list::AppListPresenterDelegate> AppListPresenterDelegateFactory::GetDelegate( app_list::AppListPresenterImpl* presenter) { - return base::MakeUnique<AppListPresenterDelegate>( + return std::make_unique<AppListPresenterDelegate>( presenter, view_delegate_factory_.get()); }
diff --git a/ash/app_list/app_list_presenter_delegate_unittest.cc b/ash/app_list/app_list_presenter_delegate_unittest.cc index 36a5d0b..2704194 100644 --- a/ash/app_list/app_list_presenter_delegate_unittest.cc +++ b/ash/app_list/app_list_presenter_delegate_unittest.cc
@@ -86,7 +86,7 @@ // Make the display big enough to hold the app list. UpdateDisplay("1024x768"); - app_list_presenter_impl_ = base::MakeUnique<TestAppListPresenterImpl>(); + app_list_presenter_impl_ = std::make_unique<TestAppListPresenterImpl>(); } void EnableFullscreenAppList() { @@ -124,7 +124,7 @@ // Make the display big enough to hold the app list. UpdateDisplay("1024x768"); - app_list_presenter_impl_ = base::MakeUnique<TestAppListPresenterImpl>(); + app_list_presenter_impl_ = std::make_unique<TestAppListPresenterImpl>(); } // Whether to run the test with mouse or gesture events.
diff --git a/ash/app_list/test_app_list_presenter_impl.cc b/ash/app_list/test_app_list_presenter_impl.cc index ed57f63..aa83606 100644 --- a/ash/app_list/test_app_list_presenter_impl.cc +++ b/ash/app_list/test_app_list_presenter_impl.cc
@@ -4,9 +4,10 @@ #include "ash/app_list/test_app_list_presenter_impl.h" +#include <memory> + #include "ash/app_list/app_list_presenter_delegate_factory.h" #include "ash/shell.h" -#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "ui/app_list/presenter/app_list.h" #include "ui/app_list/presenter/test/test_app_list_view_delegate_factory.h" @@ -14,9 +15,9 @@ namespace ash { TestAppListPresenterImpl::TestAppListPresenterImpl() - : app_list::AppListPresenterImpl(base::MakeUnique< + : app_list::AppListPresenterImpl(std::make_unique< AppListPresenterDelegateFactory>( - base::MakeUnique<app_list::test::TestAppListViewDelegateFactory>())) { + std::make_unique<app_list::test::TestAppListViewDelegateFactory>())) { // Connect Ash's app list implementation to the presenter. app_list::mojom::AppListPtr app_list_ptr; Shell::Get()->app_list()->BindRequest(mojo::MakeRequest(&app_list_ptr));
diff --git a/ash/ash_touch_exploration_manager_chromeos.cc b/ash/ash_touch_exploration_manager_chromeos.cc index 9cb7638..38bdc03 100644 --- a/ash/ash_touch_exploration_manager_chromeos.cc +++ b/ash/ash_touch_exploration_manager_chromeos.cc
@@ -4,6 +4,7 @@ #include "ash/ash_touch_exploration_manager_chromeos.h" +#include <memory> #include <vector> #include "ash/accessibility/accessibility_delegate.h" @@ -15,7 +16,6 @@ #include "ash/system/tray/system_tray_notifier.h" #include "ash/wm/window_util.h" #include "base/command_line.h" -#include "base/memory/ptr_util.h" #include "chromeos/audio/chromeos_sounds.h" #include "chromeos/audio/cras_audio_handler.h" #include "chromeos/chromeos_switches.h" @@ -191,7 +191,7 @@ if (spoken_feedback_enabled) { if (!touch_exploration_controller_.get()) { touch_exploration_controller_ = - base::MakeUnique<ui::TouchExplorationController>( + std::make_unique<ui::TouchExplorationController>( root_window_controller_->GetRootWindow(), this, touch_accessibility_enabler_->GetWeakPtr()); }
diff --git a/ash/autoclick/mus/autoclick_application.cc b/ash/autoclick/mus/autoclick_application.cc index ed41058..14ec3f7 100644 --- a/ash/autoclick/mus/autoclick_application.cc +++ b/ash/autoclick/mus/autoclick_application.cc
@@ -4,9 +4,10 @@ #include "ash/autoclick/mus/autoclick_application.h" +#include <utility> + #include "ash/public/cpp/shell_window_ids.h" #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" #include "services/service_manager/public/cpp/connector.h"
diff --git a/ash/display/display_animator_chromeos.cc b/ash/display/display_animator_chromeos.cc index d7956d2..8c4ac26 100644 --- a/ash/display/display_animator_chromeos.cc +++ b/ash/display/display_animator_chromeos.cc
@@ -4,6 +4,8 @@ #include "ash/display/display_animator_chromeos.h" +#include <memory> + #include "ash/public/cpp/shell_window_ids.h" #include "ash/shell.h" #include "base/bind.h" @@ -32,7 +34,7 @@ : completed_counter_(0), animation_aborted_(false), callback_(callback) {} void AddNewAnimator(ui::LayerAnimator* animator) { - auto observer = base::MakeUnique<Observer>(animator, this); + auto observer = std::make_unique<Observer>(animator, this); animator->AddObserver(observer.get()); observer_list_.push_back(std::move(observer)); } @@ -111,7 +113,7 @@ // after the animation of OnDisplayModeChanged(). for (aura::Window* root_window : Shell::Get()->GetAllRootWindows()) { std::unique_ptr<ui::Layer> hiding_layer = - base::MakeUnique<ui::Layer>(ui::LAYER_SOLID_COLOR); + std::make_unique<ui::Layer>(ui::LAYER_SOLID_COLOR); hiding_layer->SetColor(SK_ColorBLACK); hiding_layer->SetBounds(root_window->bounds()); ui::Layer* parent = ash::Shell::GetContainer(
diff --git a/ash/display/display_color_manager_chromeos_unittest.cc b/ash/display/display_color_manager_chromeos_unittest.cc index 9f3a9dd9..54f9f67 100644 --- a/ash/display/display_color_manager_chromeos_unittest.cc +++ b/ash/display/display_color_manager_chromeos_unittest.cc
@@ -4,8 +4,9 @@ #include "ash/display/display_color_manager_chromeos.h" +#include <memory> + #include "base/files/file_util.h" -#include "base/memory/ptr_util.h" #include "base/path_service.h" #include "base/run_loop.h" #include "base/strings/pattern.h" @@ -114,7 +115,7 @@ native_display_delegate_)); color_manager_ = - base::MakeUnique<DisplayColorManagerForTest>(&configurator_); + std::make_unique<DisplayColorManagerForTest>(&configurator_); EXPECT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &color_path_));
diff --git a/ash/display/display_manager_unittest.cc b/ash/display/display_manager_unittest.cc index 559da34..3e6bc14 100644 --- a/ash/display/display_manager_unittest.cc +++ b/ash/display/display_manager_unittest.cc
@@ -3027,6 +3027,45 @@ EXPECT_TRUE(has_default); } +// It's difficult to test with full stack due to crbug.com/771178. +// Improve the coverage once it is fixed. +TEST_F(DisplayManagerTest, ForcedMirrorMode) { + constexpr int64_t id1 = 1; + constexpr int64_t id2 = 2; + display::Screen* screen = display::Screen::GetScreen(); + DCHECK(screen); + Shell* shell = Shell::Get(); + display::DisplayChangeObserver observer(shell->display_configurator(), + display_manager()); + display::DisplayConfigurator::DisplayStateList outputs; + std::unique_ptr<display::DisplaySnapshot> snapshot1 = + display::FakeDisplaySnapshot::Builder() + .SetId(id1) + .SetNativeMode(MakeDisplayMode()) + .Build(); + std::unique_ptr<display::DisplaySnapshot> snapshot2 = + display::FakeDisplaySnapshot::Builder() + .SetId(id2) + .SetNativeMode(MakeDisplayMode()) + .Build(); + + outputs.push_back(snapshot1.get()); + outputs.push_back(snapshot2.get()); + + EXPECT_EQ(display::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED, + observer.GetStateForDisplayIds(outputs)); + + display_manager()->layout_store()->set_forced_mirror_mode(true); + + EXPECT_EQ(display::MULTIPLE_DISPLAY_STATE_DUAL_MIRROR, + observer.GetStateForDisplayIds(outputs)); + + display_manager()->layout_store()->set_forced_mirror_mode(false); + + EXPECT_EQ(display::MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED, + observer.GetStateForDisplayIds(outputs)); +} + namespace { class DisplayManagerOrientationTest : public DisplayManagerTest {
diff --git a/ash/display/display_util.cc b/ash/display/display_util.cc index 6421aec4..d2d154c 100644 --- a/ash/display/display_util.cc +++ b/ash/display/display_util.cc
@@ -5,6 +5,7 @@ #include "ash/display/display_util.h" #include <algorithm> +#include <memory> #include <utility> #include "ash/display/extended_mouse_warp_controller.h" @@ -16,7 +17,6 @@ #include "ash/shell.h" #include "ash/strings/grit/ash_strings.h" #include "ash/system/system_notifier.h" -#include "base/memory/ptr_util.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h" #include "base/sys_info.h" @@ -80,12 +80,12 @@ display::DisplayManager* manager, aura::Window* drag_source) { if (manager->IsInUnifiedMode() && manager->num_connected_displays() >= 2) - return base::MakeUnique<UnifiedMouseWarpController>(); + return std::make_unique<UnifiedMouseWarpController>(); // Extra check for |num_connected_displays()| is for SystemDisplayApiTest // that injects MockScreen. if (manager->GetNumDisplays() < 2 || manager->num_connected_displays() < 2) - return base::MakeUnique<NullMouseWarpController>(); - return base::MakeUnique<ExtendedMouseWarpController>(drag_source); + return std::make_unique<NullMouseWarpController>(); + return std::make_unique<ExtendedMouseWarpController>(drag_source); } gfx::Rect GetNativeEdgeBounds(AshWindowTreeHost* ash_host,
diff --git a/ash/display/extended_mouse_warp_controller.cc b/ash/display/extended_mouse_warp_controller.cc index 5c646074..02d0099 100644 --- a/ash/display/extended_mouse_warp_controller.cc +++ b/ash/display/extended_mouse_warp_controller.cc
@@ -5,13 +5,13 @@ #include "ash/display/extended_mouse_warp_controller.h" #include <cmath> +#include <memory> #include "ash/display/display_util.h" #include "ash/display/shared_display_edge_indicator.h" #include "ash/display/window_tree_host_manager.h" #include "ash/root_window_controller.h" #include "ash/shell.h" -#include "base/memory/ptr_util.h" #include "ui/aura/window.h" #include "ui/display/display_layout.h" #include "ui/display/manager/display_manager.h" @@ -212,7 +212,7 @@ AdjustSourceEdgeBounds(b.bounds(), snap_barrier, &b_edge); } - return base::MakeUnique<WarpRegion>(a.id(), b.id(), a_edge, b_edge); + return std::make_unique<WarpRegion>(a.id(), b.id(), a_edge, b_edge); } } // namespace ash
diff --git a/ash/display/touch_calibrator_controller.cc b/ash/display/touch_calibrator_controller.cc index fd24834..64532a6 100644 --- a/ash/display/touch_calibrator_controller.cc +++ b/ash/display/touch_calibrator_controller.cc
@@ -4,10 +4,11 @@ #include "ash/display/touch_calibrator_controller.h" +#include <memory> + #include "ash/display/touch_calibrator_view.h" #include "ash/shell.h" #include "ash/touch/ash_touch_transform_controller.h" -#include "base/memory/ptr_util.h" #include "base/threading/thread_task_runner_handle.h" #include "ui/display/screen.h" #include "ui/events/devices/device_data_manager.h" @@ -91,7 +92,7 @@ for (const display::Display& display : displays) { bool is_primary_view = display.id() == target_display_.id(); touch_calibrator_views_[display.id()] = - base::MakeUnique<TouchCalibratorView>(display, is_primary_view); + std::make_unique<TouchCalibratorView>(display, is_primary_view); } }
diff --git a/ash/display/touch_calibrator_view.cc b/ash/display/touch_calibrator_view.cc index fc4551e..1deadea9 100644 --- a/ash/display/touch_calibrator_view.cc +++ b/ash/display/touch_calibrator_view.cc
@@ -4,10 +4,11 @@ #include "ash/display/touch_calibrator_view.h" +#include <memory> + #include "ash/public/cpp/shell_window_ids.h" #include "ash/resources/vector_icons/vector_icons.h" #include "ash/shell.h" -#include "base/memory/ptr_util.h" #include "ui/aura/window.h" #include "ui/base/resource/resource_bundle.h" #include "ui/compositor/scoped_layer_animation_settings.h" @@ -309,7 +310,7 @@ HintBox::HintBox(const gfx::Rect& bounds, int border_radius) : border_radius_(border_radius) { - SetBorder(base::MakeUnique<views::BubbleBorder>( + SetBorder(std::make_unique<views::BubbleBorder>( base::i18n::IsRTL() ? views::BubbleBorder::RIGHT_CENTER : views::BubbleBorder::LEFT_CENTER, views::BubbleBorder::NO_SHADOW_OPAQUE_BORDER, SK_ColorWHITE));
diff --git a/ash/display/window_tree_host_manager.h b/ash/display/window_tree_host_manager.h index 1f6c603..fefcd64 100644 --- a/ash/display/window_tree_host_manager.h +++ b/ash/display/window_tree_host_manager.h
@@ -53,6 +53,8 @@ // TODO(oshima): Consider moving this to display::DisplayObserver. class ASH_EXPORT Observer { public: + virtual ~Observer() {} + // Invoked only once after all displays are initialized // after startup. virtual void OnDisplaysInitialized() {} @@ -86,9 +88,6 @@ // the deletion). virtual void OnWindowTreeHostsSwappedDisplays(AshWindowTreeHost* host1, AshWindowTreeHost* host2) {} - - protected: - virtual ~Observer() {} }; WindowTreeHostManager();
diff --git a/ash/drag_drop/drag_drop_controller.cc b/ash/drag_drop/drag_drop_controller.cc index 2a7d020..772a61b 100644 --- a/ash/drag_drop/drag_drop_controller.cc +++ b/ash/drag_drop/drag_drop_controller.cc
@@ -4,13 +4,13 @@ #include "ash/drag_drop/drag_drop_controller.h" +#include <memory> #include <utility> #include "ash/drag_drop/drag_drop_tracker.h" #include "ash/drag_drop/drag_image_view.h" #include "ash/shell.h" #include "base/bind.h" -#include "base/memory/ptr_util.h" #include "base/message_loop/message_loop.h" #include "base/metrics/histogram_macros.h" #include "base/run_loop.h" @@ -207,7 +207,7 @@ gfx::Rect(start_location - provider->GetDragImageOffset(), provider->GetDragImage().size()); drag_image_ = - base::MakeUnique<DragImageView>(source_window->GetRootWindow(), source); + std::make_unique<DragImageView>(source_window->GetRootWindow(), source); drag_image_->SetImage(provider->GetDragImage()); drag_image_offset_ = provider->GetDragImageOffset(); gfx::Rect drag_image_bounds(start_location, drag_image_->GetPreferredSize());
diff --git a/ash/fast_ink/fast_ink_view.cc b/ash/fast_ink/fast_ink_view.cc index 6c87fbb..63b43f3a 100644 --- a/ash/fast_ink/fast_ink_view.cc +++ b/ash/fast_ink/fast_ink_view.cc
@@ -8,6 +8,8 @@ #include <GLES2/gl2ext.h> #include <GLES2/gl2extchromium.h> +#include <memory> + #include "ash/public/cpp/shell_window_ids.h" #include "ash/shell.h" #include "base/threading/thread_task_runner_handle.h" @@ -300,7 +302,7 @@ // Create new resource if needed. if (!resource) - resource = base::MakeUnique<Resource>(); + resource = std::make_unique<Resource>(); // Acquire context provider for resource if needed. // Note: We make no attempts to recover if the context provider is later
diff --git a/ash/first_run/desktop_cleaner.cc b/ash/first_run/desktop_cleaner.cc index a170489..0f6a9ca 100644 --- a/ash/first_run/desktop_cleaner.cc +++ b/ash/first_run/desktop_cleaner.cc
@@ -4,9 +4,10 @@ #include "ash/first_run/desktop_cleaner.h" +#include <memory> + #include "ash/public/cpp/shell_window_ids.h" #include "ash/shell.h" -#include "base/memory/ptr_util.h" #include "ui/aura/window_event_dispatcher.h" #include "ui/aura/window_observer.h" #include "ui/compositor/layer_animation_observer.h" @@ -96,7 +97,7 @@ for (size_t i = 0; i < arraysize(kContainerIdsToHide); ++i) { aura::Window* container = Shell::GetContainer(root_window, kContainerIdsToHide[i]); - container_hiders_.push_back(base::MakeUnique<ContainerHider>(container)); + container_hiders_.push_back(std::make_unique<ContainerHider>(container)); } notification_blocker_.reset(new NotificationBlocker()); }
diff --git a/ash/frame/caption_buttons/frame_size_button.cc b/ash/frame/caption_buttons/frame_size_button.cc index f5a8d84..d251701c 100644 --- a/ash/frame/caption_buttons/frame_size_button.cc +++ b/ash/frame/caption_buttons/frame_size_button.cc
@@ -4,12 +4,13 @@ #include "ash/frame/caption_buttons/frame_size_button.h" +#include <memory> + #include "ash/wm/window_positioning_utils.h" #include "ash/wm/window_state.h" #include "ash/wm/wm_event.h" #include "ash/wm/workspace/phantom_window_controller.h" #include "base/i18n/rtl.h" -#include "base/memory/ptr_util.h" #include "base/metrics/user_metrics.h" #include "ui/aura/window.h" #include "ui/gfx/geometry/vector2d.h" @@ -215,7 +216,7 @@ aura::Window* window = frame_->GetNativeWindow(); if (!phantom_window_controller_.get()) { phantom_window_controller_ = - base::MakeUnique<PhantomWindowController>(window); + std::make_unique<PhantomWindowController>(window); } gfx::Rect phantom_bounds_in_screen = (snap_type_ == SNAP_LEFT)
diff --git a/ash/frame/custom_frame_view_ash.cc b/ash/frame/custom_frame_view_ash.cc index b2138ad..93d4a31 100644 --- a/ash/frame/custom_frame_view_ash.cc +++ b/ash/frame/custom_frame_view_ash.cc
@@ -5,6 +5,7 @@ #include "ash/frame/custom_frame_view_ash.h" #include <algorithm> +#include <memory> #include <vector> #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" @@ -21,7 +22,6 @@ #include "ash/wm/window_state_delegate.h" #include "ash/wm/window_state_observer.h" #include "ash/wm/window_util.h" -#include "base/memory/ptr_util.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/window.h" #include "ui/aura/window_observer.h" @@ -306,7 +306,7 @@ overlay_view_(new OverlayView(header_view_)), immersive_delegate_(immersive_delegate ? immersive_delegate : header_view_), - avatar_observer_(base::MakeUnique<AvatarObserver>(frame_, header_view_)) { + avatar_observer_(std::make_unique<AvatarObserver>(frame_, header_view_)) { aura::Window* frame_window = frame->GetNativeWindow(); wm::InstallResizeHandleWindowTargeterForWindow(frame_window, nullptr); // |header_view_| is set as the non client view's overlay view so that it can
diff --git a/ash/frame/header_view.cc b/ash/frame/header_view.cc index 178fd5f..24a2632 100644 --- a/ash/frame/header_view.cc +++ b/ash/frame/header_view.cc
@@ -4,6 +4,8 @@ #include "ash/frame/header_view.h" +#include <memory> + #include "ash/frame/caption_buttons/frame_caption_button_container_view.h" #include "ash/frame/default_header_painter.h" #include "ash/shell.h" @@ -17,7 +19,7 @@ HeaderView::HeaderView(views::Widget* target_widget, mojom::WindowStyle window_style) : target_widget_(target_widget), - header_painter_(base::MakeUnique<DefaultHeaderPainter>(window_style)), + header_painter_(std::make_unique<DefaultHeaderPainter>(window_style)), avatar_icon_(nullptr), caption_button_container_(nullptr), fullscreen_visible_fraction_(0) {
diff --git a/ash/highlighter/highlighter_controller.cc b/ash/highlighter/highlighter_controller.cc index 0211c7b..9a10077b 100644 --- a/ash/highlighter/highlighter_controller.cc +++ b/ash/highlighter/highlighter_controller.cc
@@ -4,6 +4,8 @@ #include "ash/highlighter/highlighter_controller.h" +#include <memory> + #include "ash/highlighter/highlighter_gesture_util.h" #include "ash/highlighter/highlighter_result_view.h" #include "ash/highlighter/highlighter_selection_observer.h" @@ -96,7 +98,7 @@ base::TimeDelta presentation_delay, aura::Window* root_window) { highlighter_view_ = - base::MakeUnique<HighlighterView>(presentation_delay, root_window); + std::make_unique<HighlighterView>(presentation_delay, root_window); result_view_.reset(); } @@ -127,7 +129,7 @@ // a little to give the pen a chance to re-enter the screen. highlighter_view_->AddGap(); - interrupted_stroke_timer_ = base::MakeUnique<base::OneShotTimer>(); + interrupted_stroke_timer_ = std::make_unique<base::OneShotTimer>(); interrupted_stroke_timer_->Start( FROM_HERE, base::TimeDelta::FromMilliseconds(kInterruptedStrokeTimeoutMs), base::Bind(&HighlighterController::RecognizeGesture, @@ -177,7 +179,7 @@ gfx::ScaleRect(box, GetScreenshotScale(current_window)))); } - result_view_ = base::MakeUnique<HighlighterResultView>(current_window); + result_view_ = std::make_unique<HighlighterResultView>(current_window); result_view_->Animate(box, gesture_type, base::Bind(&HighlighterController::DestroyResultView, base::Unretained(this)));
diff --git a/ash/highlighter/highlighter_controller_unittest.cc b/ash/highlighter/highlighter_controller_unittest.cc index 1e61fae..69e73f37 100644 --- a/ash/highlighter/highlighter_controller_unittest.cc +++ b/ash/highlighter/highlighter_controller_unittest.cc
@@ -4,6 +4,8 @@ #include "ash/highlighter/highlighter_controller.h" +#include <memory> + #include "ash/fast_ink/fast_ink_points.h" #include "ash/highlighter/highlighter_controller_test_api.h" #include "ash/public/cpp/config.h" @@ -22,7 +24,7 @@ void SetUp() override { AshTestBase::SetUp(); - controller_test_api_ = base::MakeUnique<HighlighterControllerTestApi>( + controller_test_api_ = std::make_unique<HighlighterControllerTestApi>( Shell::Get()->highlighter_controller()); }
diff --git a/ash/highlighter/highlighter_result_view.cc b/ash/highlighter/highlighter_result_view.cc index e8a278f..40b142f 100644 --- a/ash/highlighter/highlighter_result_view.cc +++ b/ash/highlighter/highlighter_result_view.cc
@@ -4,6 +4,8 @@ #include "ash/highlighter/highlighter_result_view.h" +#include <memory> + #include "ash/highlighter/highlighter_gesture_util.h" #include "ash/highlighter/highlighter_view.h" #include "ash/public/cpp/shell_window_ids.h" @@ -163,7 +165,7 @@ } // namespace HighlighterResultView::HighlighterResultView(aura::Window* root_window) { - widget_ = base::MakeUnique<views::Widget>(); + widget_ = std::make_unique<views::Widget>(); views::Widget::InitParams params; params.type = views::Widget::InitParams::TYPE_WINDOW_FRAMELESS; @@ -196,7 +198,7 @@ if (gesture_type == HighlighterGestureType::kHorizontalStroke) { // The original stroke is fading out in place. // Fade in a solid transparent rectangle. - result_layer_ = base::MakeUnique<ui::Layer>(ui::LAYER_SOLID_COLOR); + result_layer_ = std::make_unique<ui::Layer>(ui::LAYER_SOLID_COLOR); result_layer_->set_name("HighlighterResultView:SOLID_LAYER"); result_layer_->SetBounds(gfx::ToEnclosingRect(bounds)); result_layer_->SetFillsBoundsOpaquely(false); @@ -212,7 +214,7 @@ DCHECK(gesture_type == HighlighterGestureType::kClosedShape); // The original stroke is fading out and inflating. // Fade in the deflating lens overlay. - result_layer_ = base::MakeUnique<ResultLayer>(gfx::ToEnclosingRect(bounds)); + result_layer_ = std::make_unique<ResultLayer>(gfx::ToEnclosingRect(bounds)); layer->Add(result_layer_.get()); gfx::Transform transform; @@ -228,7 +230,7 @@ layer->SetOpacity(0); - animation_timer_ = base::MakeUnique<base::OneShotTimer>(); + animation_timer_ = std::make_unique<base::OneShotTimer>(); animation_timer_->Start(FROM_HERE, delay, base::Bind(&HighlighterResultView::FadeIn, base::Unretained(this), duration, done)); @@ -250,7 +252,7 @@ layer->SetTransform(transform); } - animation_timer_ = base::MakeUnique<base::OneShotTimer>(); + animation_timer_ = std::make_unique<base::OneShotTimer>(); animation_timer_->Start( FROM_HERE, duration + base::TimeDelta::FromMilliseconds(kResultFadeoutDelayMs), @@ -269,7 +271,7 @@ settings.SetTweenType(gfx::Tween::LINEAR_OUT_SLOW_IN); layer->SetOpacity(0); - animation_timer_ = base::MakeUnique<base::OneShotTimer>(); + animation_timer_ = std::make_unique<base::OneShotTimer>(); animation_timer_->Start(FROM_HERE, duration, done); }
diff --git a/ash/highlighter/highlighter_view.cc b/ash/highlighter/highlighter_view.cc index 3a1a9ad..41c6473 100644 --- a/ash/highlighter/highlighter_view.cc +++ b/ash/highlighter/highlighter_view.cc
@@ -4,6 +4,8 @@ #include "ash/highlighter/highlighter_view.h" +#include <memory> + #include "ash/highlighter/highlighter_gesture_util.h" #include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkTypes.h" @@ -116,7 +118,7 @@ void HighlighterView::Animate(const gfx::PointF& pivot, HighlighterGestureType gesture_type, const base::Closure& done) { - animation_timer_ = base::MakeUnique<base::OneShotTimer>(); + animation_timer_ = std::make_unique<base::OneShotTimer>(); animation_timer_->Start( FROM_HERE, base::TimeDelta::FromMilliseconds(kStrokeFadeoutDelayMs), base::Bind(&HighlighterView::FadeOut, base::Unretained(this), pivot, @@ -156,7 +158,7 @@ layer->SetTransform(transform); } - animation_timer_ = base::MakeUnique<base::OneShotTimer>(); + animation_timer_ = std::make_unique<base::OneShotTimer>(); animation_timer_->Start(FROM_HERE, duration, done); }
diff --git a/ash/host/ash_window_tree_host.cc b/ash/host/ash_window_tree_host.cc index ff7fc5f..967cc6a 100644 --- a/ash/host/ash_window_tree_host.cc +++ b/ash/host/ash_window_tree_host.cc
@@ -4,11 +4,12 @@ #include "ash/host/ash_window_tree_host.h" +#include <memory> + #include "ash/host/ash_window_tree_host_init_params.h" #include "ash/host/ash_window_tree_host_platform.h" #include "ash/host/ash_window_tree_host_unified.h" #include "ash/shell_port.h" -#include "base/memory/ptr_util.h" #include "ui/aura/client/screen_position_client.h" #include "ui/aura/env.h" #include "ui/aura/window_tree_host.h" @@ -60,10 +61,10 @@ return ash_window_tree_host; if (init_params.offscreen) { - return base::MakeUnique<AshWindowTreeHostUnified>( + return std::make_unique<AshWindowTreeHostUnified>( init_params.initial_bounds); } - return base::MakeUnique<AshWindowTreeHostPlatform>( + return std::make_unique<AshWindowTreeHostPlatform>( init_params.initial_bounds); }
diff --git a/ash/host/ash_window_tree_host_unified.cc b/ash/host/ash_window_tree_host_unified.cc index f0ab6761..862eca0 100644 --- a/ash/host/ash_window_tree_host_unified.cc +++ b/ash/host/ash_window_tree_host_unified.cc
@@ -4,11 +4,11 @@ #include "ash/host/ash_window_tree_host_unified.h" +#include <memory> #include <utility> #include "ash/host/root_window_transformer.h" #include "base/logging.h" -#include "base/memory/ptr_util.h" #include "ui/aura/window.h" #include "ui/aura/window_event_dispatcher.h" #include "ui/aura/window_targeter.h" @@ -70,7 +70,7 @@ AshWindowTreeHost* mirroring_ash_host) { aura::Window* src_root = mirroring_ash_host->AsWindowTreeHost()->window(); src_root->SetEventTargeter( - base::MakeUnique<UnifiedEventTargeter>(src_root, window())); + std::make_unique<UnifiedEventTargeter>(src_root, window())); DCHECK(std::find(mirroring_hosts_.begin(), mirroring_hosts_.end(), mirroring_ash_host) == mirroring_hosts_.end()); mirroring_hosts_.push_back(mirroring_ash_host);
diff --git a/ash/keyboard/keyboard_ui.cc b/ash/keyboard/keyboard_ui.cc index b4b0d72a..0022b03 100644 --- a/ash/keyboard/keyboard_ui.cc +++ b/ash/keyboard/keyboard_ui.cc
@@ -4,13 +4,14 @@ #include "ash/keyboard/keyboard_ui.h" +#include <memory> + #include "ash/accessibility/accessibility_delegate.h" #include "ash/keyboard/keyboard_ui_observer.h" #include "ash/shell.h" #include "ash/system/accessibility_observer.h" #include "ash/system/tray/system_tray_notifier.h" #include "ash/system/tray_accessibility.h" -#include "base/memory/ptr_util.h" #include "ui/keyboard/keyboard_controller.h" namespace ash { @@ -64,7 +65,7 @@ // static std::unique_ptr<KeyboardUI> KeyboardUI::Create() { - return base::WrapUnique(new KeyboardUIImpl); + return std::make_unique<KeyboardUIImpl>(); } void KeyboardUI::AddObserver(KeyboardUIObserver* observer) {
diff --git a/ash/laser/laser_pointer_controller.cc b/ash/laser/laser_pointer_controller.cc index b72fc465..134aa92 100644 --- a/ash/laser/laser_pointer_controller.cc +++ b/ash/laser/laser_pointer_controller.cc
@@ -4,6 +4,8 @@ #include "ash/laser/laser_pointer_controller.h" +#include <memory> + #include "ash/laser/laser_pointer_view.h" #include "ash/system/palette/palette_utils.h" #include "ui/display/screen.h" @@ -45,7 +47,7 @@ void LaserPointerController::CreatePointerView( base::TimeDelta presentation_delay, aura::Window* root_window) { - laser_pointer_view_ = base::MakeUnique<LaserPointerView>( + laser_pointer_view_ = std::make_unique<LaserPointerView>( base::TimeDelta::FromMilliseconds(kPointLifeDurationMs), presentation_delay, base::TimeDelta::FromMilliseconds(kAddStationaryPointsDelayMs),
diff --git a/ash/laser/laser_segment_utils_unittest.cc b/ash/laser/laser_segment_utils_unittest.cc index b180084..26ffb10 100644 --- a/ash/laser/laser_segment_utils_unittest.cc +++ b/ash/laser/laser_segment_utils_unittest.cc
@@ -4,7 +4,6 @@ #include "ash/laser/laser_segment_utils.h" #include "ash/test/ash_test_base.h" -#include "base/memory/ptr_util.h" #include "ui/gfx/geometry/angle_conversions.h" #include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/point_f.h"
diff --git a/ash/login/mock_lock_screen_client.cc b/ash/login/mock_lock_screen_client.cc index 786f639..e6741a5 100644 --- a/ash/login/mock_lock_screen_client.cc +++ b/ash/login/mock_lock_screen_client.cc
@@ -4,6 +4,8 @@ #include "ash/login/mock_lock_screen_client.h" +#include <memory> + #include "ash/login/lock_screen_controller.h" #include "ash/shell.h" @@ -30,7 +32,7 @@ std::unique_ptr<MockLockScreenClient> BindMockLockScreenClient() { LockScreenController* lock_screen_controller = Shell::Get()->lock_screen_controller(); - auto lock_screen_client = base::MakeUnique<MockLockScreenClient>(); + auto lock_screen_client = std::make_unique<MockLockScreenClient>(); lock_screen_controller->SetClient( lock_screen_client->CreateInterfacePtrAndBind()); return lock_screen_client;
diff --git a/ash/login/ui/lock_contents_view.cc b/ash/login/ui/lock_contents_view.cc index 2210885..5286277 100644 --- a/ash/login/ui/lock_contents_view.cc +++ b/ash/login/ui/lock_contents_view.cc
@@ -4,6 +4,8 @@ #include "ash/login/ui/lock_contents_view.h" +#include <memory> + #include "ash/focus_cycler.h" #include "ash/ime/ime_controller.h" #include "ash/login/lock_screen_controller.h" @@ -172,7 +174,7 @@ display_observer_.Add(display::Screen::GetScreen()); Shell::Get()->lock_screen_controller()->AddLockScreenAppsFocusObserver(this); Shell::Get()->system_tray_notifier()->AddSystemTrayFocusObserver(this); - error_bubble_ = base::MakeUnique<LoginBubble>(); + error_bubble_ = std::make_unique<LoginBubble>(); // We reuse the focusable state on this view as a signal that focus should // switch to the system tray. LockContentsView should otherwise not be
diff --git a/ash/login/ui/lock_debug_view.cc b/ash/login/ui/lock_debug_view.cc index 38c69e9..2bab8aaa 100644 --- a/ash/login/ui/lock_debug_view.cc +++ b/ash/login/ui/lock_debug_view.cc
@@ -5,6 +5,7 @@ #include "ash/login/ui/lock_debug_view.h" #include <algorithm> +#include <memory> #include <string> #include "ash/login/ui/layout_util.h" @@ -171,7 +172,7 @@ LockDebugView::LockDebugView(mojom::TrayActionState initial_note_action_state, LoginDataDispatcher* data_dispatcher) - : debug_data_dispatcher_(base::MakeUnique<DebugDataDispatcherTransformer>( + : debug_data_dispatcher_(std::make_unique<DebugDataDispatcherTransformer>( initial_note_action_state, data_dispatcher)) { SetLayoutManager(new views::BoxLayout(views::BoxLayout::kHorizontal));
diff --git a/ash/login/ui/lock_screen.cc b/ash/login/ui/lock_screen.cc index 47448397..bf7b89c 100644 --- a/ash/login/ui/lock_screen.cc +++ b/ash/login/ui/lock_screen.cc
@@ -4,6 +4,7 @@ #include "ash/login/ui/lock_screen.h" +#include <memory> #include <utility> #include "ash/login/ui/lock_contents_view.h" @@ -18,7 +19,6 @@ #include "ash/tray_action/tray_action.h" #include "ash/wallpaper/wallpaper_widget_controller.h" #include "base/command_line.h" -#include "base/memory/ptr_util.h" #include "chromeos/chromeos_switches.h" #include "ui/compositor/layer.h" #include "ui/display/display.h" @@ -66,7 +66,7 @@ CHECK(!instance_); instance_ = new LockScreen(); - auto data_dispatcher = base::MakeUnique<LoginDataDispatcher>(); + auto data_dispatcher = std::make_unique<LoginDataDispatcher>(); auto* contents = BuildContentsView( ash::Shell::Get()->tray_action()->GetLockScreenNoteState(), data_dispatcher.get());
diff --git a/ash/login/ui/login_auth_user_view.cc b/ash/login/ui/login_auth_user_view.cc index 06240a55..436769d 100644 --- a/ash/login/ui/login_auth_user_view.cc +++ b/ash/login/ui/login_auth_user_view.cc
@@ -4,6 +4,8 @@ #include "ash/login/ui/login_auth_user_view.h" +#include <memory> + #include "ash/login/lock_screen_controller.h" #include "ash/login/ui/lock_screen.h" #include "ash/login/ui/login_constants.h" @@ -225,7 +227,7 @@ void LoginAuthUserView::CaptureStateForAnimationPreLayout() { DCHECK(!cached_animation_state_); - cached_animation_state_ = base::MakeUnique<AnimationState>(this); + cached_animation_state_ = std::make_unique<AnimationState>(this); } void LoginAuthUserView::ApplyAnimationPostLayout() { @@ -248,7 +250,7 @@ // requires a y offset. // Note: Doing this animation via ui::ScopedLayerAnimationSettings works, but // it seems that the timing gets slightly out of sync with the PIN animation. - auto move_to_center = base::MakeUnique<ui::InterpolatedTranslation>( + auto move_to_center = std::make_unique<ui::InterpolatedTranslation>( gfx::PointF(0, cached_animation_state_->non_pin_y_start_in_screen - non_pin_y_end_in_screen), gfx::PointF()); @@ -298,7 +300,7 @@ pin_view_->SetBoundsRect(pin_bounds); } - auto transition = base::MakeUnique<PinKeyboardAnimation>( + auto transition = std::make_unique<PinKeyboardAnimation>( has_pin /*grow*/, pin_view_->height(), base::TimeDelta::FromMilliseconds( login_constants::kChangeUserAnimationDurationMs),
diff --git a/ash/login/ui/login_bubble_unittest.cc b/ash/login/ui/login_bubble_unittest.cc index 88c878f..e5a9139 100644 --- a/ash/login/ui/login_bubble_unittest.cc +++ b/ash/login/ui/login_bubble_unittest.cc
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <memory> + #include "ash/login/ui/login_bubble.h" #include "ash/login/ui/login_test_base.h" #include "testing/gtest/include/gtest/gtest.h" @@ -54,7 +56,7 @@ container_->AddChildView(other_view_); SetWidget(CreateWidgetWithContent(container_)); - bubble_ = base::MakeUnique<LoginBubble>(); + bubble_ = std::make_unique<LoginBubble>(); } void TearDown() override {
diff --git a/ash/login/ui/login_pin_view.cc b/ash/login/ui/login_pin_view.cc index 8e18b45..c2db0a3a 100644 --- a/ash/login/ui/login_pin_view.cc +++ b/ash/login/ui/login_pin_view.cc
@@ -4,12 +4,13 @@ #include "ash/login/ui/login_pin_view.h" +#include <memory> + #include "ash/ash_constants.h" #include "ash/login/ui/login_constants.h" #include "ash/resources/vector_icons/vector_icons.h" #include "ash/strings/grit/ash_strings.h" #include "base/callback.h" -#include "base/memory/ptr_util.h" #include "base/strings/utf_string_conversions.h" #include "base/timer/timer.h" #include "ui/base/l10n/l10n_util.h" @@ -107,7 +108,7 @@ std::unique_ptr<views::InkDrop> CreateInkDrop() override { std::unique_ptr<views::InkDropImpl> ink_drop = - base::MakeUnique<views::InkDropImpl>(this, size()); + std::make_unique<views::InkDropImpl>(this, size()); ink_drop->SetShowHighlightOnHover(false); ink_drop->SetShowHighlightOnFocus(false); ink_drop->SetAutoHighlightMode( @@ -116,7 +117,7 @@ } std::unique_ptr<views::InkDropMask> CreateInkDropMask() const override { - return base::MakeUnique<views::CircleInkDropMask>( + return std::make_unique<views::CircleInkDropMask>( size(), GetLocalBounds().CenterPoint(), LoginPinView::kButtonSizeDp / 2); } @@ -127,7 +128,7 @@ center.y() - LoginPinView::kButtonSizeDp / 2, LoginPinView::kButtonSizeDp, LoginPinView::kButtonSizeDp); - return base::MakeUnique<views::FloodFillInkDropRipple>( + return std::make_unique<views::FloodFillInkDropRipple>( size(), GetLocalBounds().InsetsFrom(bounds), GetInkDropCenterBasedOnLastEvent(), kInkDropRippleColor, 1.f /*visible_opacity*/); @@ -135,9 +136,9 @@ std::unique_ptr<views::InkDropHighlight> CreateInkDropHighlight() const override { - return base::MakeUnique<views::InkDropHighlight>( + return std::make_unique<views::InkDropHighlight>( gfx::PointF(GetLocalBounds().CenterPoint()), - base::MakeUnique<views::CircleLayerDelegate>( + std::make_unique<views::CircleLayerDelegate>( kInkDropHighlightColor, LoginPinView::kButtonSizeDp / 2)); } @@ -197,8 +198,8 @@ public: BackspacePinButton(const base::Closure& on_press) : BasePinButton(on_press), - delay_timer_(base::MakeUnique<base::OneShotTimer>()), - repeat_timer_(base::MakeUnique<base::RepeatingTimer>()) { + delay_timer_(std::make_unique<base::OneShotTimer>()), + repeat_timer_(std::make_unique<base::RepeatingTimer>()) { image_ = new views::ImageView(); AddChildView(image_);
diff --git a/ash/login/ui/login_pin_view_unittest.cc b/ash/login/ui/login_pin_view_unittest.cc index 0f6201b..0d910bf 100644 --- a/ash/login/ui/login_pin_view_unittest.cc +++ b/ash/login/ui/login_pin_view_unittest.cc
@@ -4,6 +4,8 @@ #include "ash/login/ui/login_password_view.h" +#include <memory> + #include "ash/login/ui/login_pin_view.h" #include "ash/login/ui/login_test_base.h" #include "base/timer/mock_timer.h" @@ -125,9 +127,9 @@ LoginPinView::TestApi test_api(view_); // Install mock timers into the PIN view. - auto delay_timer0 = base::MakeUnique<base::MockTimer>( + auto delay_timer0 = std::make_unique<base::MockTimer>( true /*retain_user_task*/, false /*is_repeating*/); - auto repeat_timer0 = base::MakeUnique<base::MockTimer>( + auto repeat_timer0 = std::make_unique<base::MockTimer>( true /*retain_user_task*/, true /*is_repeating*/); base::MockTimer* delay_timer = delay_timer0.get(); base::MockTimer* repeat_timer = repeat_timer0.get();
diff --git a/ash/login/ui/login_user_view.cc b/ash/login/ui/login_user_view.cc index 1a1b32a5..1b996e7 100644 --- a/ash/login/ui/login_user_view.cc +++ b/ash/login/ui/login_user_view.cc
@@ -4,6 +4,8 @@ #include "ash/login/ui/login_user_view.h" +#include <memory> + #include "ash/ash_constants.h" #include "ash/login/ui/animated_rounded_image_view.h" #include "ash/login/ui/image_parser.h" @@ -251,7 +253,7 @@ const OnTap& on_tap) : views::Button(this), on_tap_(on_tap), - opacity_input_handler_(base::MakeUnique<OpacityInputHandler>(this)), + opacity_input_handler_(std::make_unique<OpacityInputHandler>(this)), display_style_(style) { // show_dropdown can only be true when the user view is rendering in large // mode. @@ -313,7 +315,7 @@ user_image_->layer()->GetAnimator()->StopAnimating(); // Create the image flip animation. - auto image_transition = base::MakeUnique<UserSwitchFlipAnimation>( + auto image_transition = std::make_unique<UserSwitchFlipAnimation>( user_image_->width(), 0 /*start_degrees*/, 90 /*midpoint_degrees*/, 180 /*end_degrees*/, base::TimeDelta::FromMilliseconds( @@ -395,7 +397,7 @@ on_tap_.Run(); if (user_dropdown_ && sender == user_dropdown_) { if (!user_menu_ || !user_menu_->IsVisible()) { - user_menu_ = base::MakeUnique<LoginBubble>(); + user_menu_ = std::make_unique<LoginBubble>(); base::string16 display_name = base::UTF8ToUTF16(current_user_->basic_user_info->display_name); @@ -430,7 +432,7 @@ // Animate to new opacity. auto build_settings = [](views::View* view) { - auto settings = base::MakeUnique<ui::ScopedLayerAnimationSettings>( + auto settings = std::make_unique<ui::ScopedLayerAnimationSettings>( view->layer()->GetAnimator()); settings->SetTransitionDuration( base::TimeDelta::FromMilliseconds(kUserFadeAnimationDurationMs));
diff --git a/ash/login/ui/note_action_launch_button.cc b/ash/login/ui/note_action_launch_button.cc index 103780e..0b7bd56 100644 --- a/ash/login/ui/note_action_launch_button.cc +++ b/ash/login/ui/note_action_launch_button.cc
@@ -4,6 +4,8 @@ #include "ash/login/ui/note_action_launch_button.h" +#include <memory> + #include "ash/public/interfaces/tray_action.mojom.h" #include "ash/resources/vector_icons/vector_icons.h" #include "ash/shelf/shelf_constants.h" @@ -193,7 +195,7 @@ EnableCanvasFlippingForRTLUI(true); SetPreferredSize(gfx::Size(kLargeBubbleRadiusDp, kLargeBubbleRadiusDp)); SetEventTargeter( - base::MakeUnique<views::ViewTargeter>(&event_targeter_delegate_)); + std::make_unique<views::ViewTargeter>(&event_targeter_delegate_)); // Paint to layer because the background is painted to layer - if the button // was not painted to layer as well, the background would be painted over
diff --git a/ash/login/ui/pin_keyboard_animation.cc b/ash/login/ui/pin_keyboard_animation.cc index 467830c7..7505a95 100644 --- a/ash/login/ui/pin_keyboard_animation.cc +++ b/ash/login/ui/pin_keyboard_animation.cc
@@ -4,7 +4,8 @@ #include "ash/login/ui/pin_keyboard_animation.h" -#include "base/memory/ptr_util.h" +#include <memory> + #include "ui/compositor/layer_animation_delegate.h" #include "ui/gfx/animation/tween.h" #include "ui/gfx/interpolated_transform.h" @@ -25,15 +26,15 @@ gfx::Transform to_center; to_center.Translate(0, height / 2.f); auto move_to_center = - base::MakeUnique<ui::InterpolatedConstantTransform>(to_center); + std::make_unique<ui::InterpolatedConstantTransform>(to_center); - auto scale = base::MakeUnique<ui::InterpolatedScale>( + auto scale = std::make_unique<ui::InterpolatedScale>( gfx::Point3F(1, start_opacity_, 1), gfx::Point3F(1, end_opacity_, 1)); gfx::Transform from_center; from_center.Translate(0, -height / 2.f); auto move_from_center = - base::MakeUnique<ui::InterpolatedConstantTransform>(from_center); + std::make_unique<ui::InterpolatedConstantTransform>(from_center); scale->SetChild(std::move(move_to_center)); move_from_center->SetChild(std::move(scale));
diff --git a/ash/login/ui/user_switch_flip_animation.cc b/ash/login/ui/user_switch_flip_animation.cc index b61ea26f..2154ad0 100644 --- a/ash/login/ui/user_switch_flip_animation.cc +++ b/ash/login/ui/user_switch_flip_animation.cc
@@ -4,7 +4,8 @@ #include "ash/login/ui/user_switch_flip_animation.h" -#include "base/memory/ptr_util.h" +#include <memory> + #include "ui/compositor/layer_animation_delegate.h" #include "ui/gfx/animation/tween.h" #include "ui/gfx/interpolated_transform.h" @@ -20,9 +21,9 @@ gfx::Transform to_center; to_center.Translate(width / 2.f, 0); auto move_to_center = - base::MakeUnique<ui::InterpolatedConstantTransform>(to_center); + std::make_unique<ui::InterpolatedConstantTransform>(to_center); - auto rotate = base::MakeUnique<ui::InterpolatedAxisAngleRotation>( + auto rotate = std::make_unique<ui::InterpolatedAxisAngleRotation>( gfx::Vector3dF(0, 1, 0), start_degrees, end_degrees); gfx::Transform from_center; @@ -30,7 +31,7 @@ from_center.RotateAboutYAxis(180); from_center.Translate(-width / 2.f, 0); auto move_from_center = - base::MakeUnique<ui::InterpolatedConstantTransform>(from_center); + std::make_unique<ui::InterpolatedConstantTransform>(from_center); rotate->SetChild(std::move(move_to_center)); move_from_center->SetChild(std::move(rotate));
diff --git a/ash/message_center/message_list_view_unittest.cc b/ash/message_center/message_list_view_unittest.cc index e1c0b9d..548fb93b 100644 --- a/ash/message_center/message_list_view_unittest.cc +++ b/ash/message_center/message_list_view_unittest.cc
@@ -9,7 +9,6 @@ #include "ash/message_center/message_list_view.h" #include "ash/test/ash_test_base.h" #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" #include "testing/gmock/include/gmock/gmock.h"
diff --git a/ash/metrics/task_switch_metrics_recorder.cc b/ash/metrics/task_switch_metrics_recorder.cc index 9314696..5b98a0d0 100644 --- a/ash/metrics/task_switch_metrics_recorder.cc +++ b/ash/metrics/task_switch_metrics_recorder.cc
@@ -4,8 +4,9 @@ #include "ash/metrics/task_switch_metrics_recorder.h" +#include <memory> + #include "ash/metrics/task_switch_time_tracker.h" -#include "base/memory/ptr_util.h" namespace ash { @@ -89,7 +90,7 @@ DCHECK(histogram_name); histogram_map_[static_cast<int>(task_switch_source)] = - base::MakeUnique<TaskSwitchTimeTracker>(histogram_name); + std::make_unique<TaskSwitchTimeTracker>(histogram_name); } } // namespace ash
diff --git a/ash/metrics/user_metrics_recorder.cc b/ash/metrics/user_metrics_recorder.cc index f040af6c..d44a096f 100644 --- a/ash/metrics/user_metrics_recorder.cc +++ b/ash/metrics/user_metrics_recorder.cc
@@ -4,6 +4,8 @@ #include "ash/metrics/user_metrics_recorder.h" +#include <memory> + #include "ash/metrics/desktop_task_switch_metric_recorder.h" #include "ash/metrics/pointer_metrics_recorder.h" #include "ash/public/cpp/shelf_item.h" @@ -15,7 +17,6 @@ #include "ash/shelf/shelf_view.h" #include "ash/shell.h" #include "ash/wm/window_state.h" -#include "base/memory/ptr_util.h" #include "base/metrics/histogram_macros.h" #include "base/metrics/user_metrics.h" #include "ui/aura/window.h" @@ -421,7 +422,7 @@ desktop_task_switch_metric_recorder_.reset( new DesktopTaskSwitchMetricRecorder()); } - pointer_metrics_recorder_ = base::MakeUnique<PointerMetricsRecorder>(); + pointer_metrics_recorder_ = std::make_unique<PointerMetricsRecorder>(); } void UserMetricsRecorder::OnShellShuttingDown() {
diff --git a/ash/mus/ash_window_tree_host_mus.cc b/ash/mus/ash_window_tree_host_mus.cc index 54133cf..4ec340e5 100644 --- a/ash/mus/ash_window_tree_host_mus.cc +++ b/ash/mus/ash_window_tree_host_mus.cc
@@ -4,11 +4,12 @@ #include "ash/mus/ash_window_tree_host_mus.h" +#include <memory> + #include "ash/host/root_window_transformer.h" #include "ash/host/transformer_helper.h" #include "ash/shell.h" #include "ash/shell_delegate.h" -#include "base/memory/ptr_util.h" #include "services/ui/public/cpp/input_devices/input_device_controller_client.h" #include "ui/aura/mus/window_tree_host_mus_init_params.h" #include "ui/aura/window.h" @@ -20,7 +21,7 @@ AshWindowTreeHostMus::AshWindowTreeHostMus( aura::WindowTreeHostMusInitParams init_params) : aura::WindowTreeHostMus(std::move(init_params)), - transformer_helper_(base::MakeUnique<TransformerHelper>(this)) { + transformer_helper_(std::make_unique<TransformerHelper>(this)) { transformer_helper_->Init(); } @@ -54,7 +55,7 @@ // doesn't attempt to process events while in this state, which would likely // crash. std::unique_ptr<ui::NullEventTargeter> null_event_targeter = - base::MakeUnique<ui::NullEventTargeter>(); + std::make_unique<ui::NullEventTargeter>(); window()->SetEventTargeter(std::move(null_event_targeter)); }
diff --git a/ash/mus/bridge/immersive_handler_factory_mus.cc b/ash/mus/bridge/immersive_handler_factory_mus.cc index 0b9c453..53f476d 100644 --- a/ash/mus/bridge/immersive_handler_factory_mus.cc +++ b/ash/mus/bridge/immersive_handler_factory_mus.cc
@@ -4,10 +4,11 @@ #include "ash/mus/bridge/immersive_handler_factory_mus.h" +#include <memory> + #include "ash/public/cpp/immersive/immersive_focus_watcher.h" #include "ash/public/cpp/immersive/immersive_gesture_handler.h" #include "base/logging.h" -#include "base/memory/ptr_util.h" namespace ash { namespace mus {
diff --git a/ash/mus/bridge/shell_port_mash.cc b/ash/mus/bridge/shell_port_mash.cc index 5542414e..b75d024 100644 --- a/ash/mus/bridge/shell_port_mash.cc +++ b/ash/mus/bridge/shell_port_mash.cc
@@ -4,6 +4,7 @@ #include "ash/mus/bridge/shell_port_mash.h" +#include <memory> #include <utility> #include "ash/accelerators/accelerator_controller.h" @@ -69,13 +70,13 @@ views::PointerWatcherEventRouter* pointer_watcher_event_router) : window_manager_(window_manager) { if (GetAshConfig() == Config::MASH) { - mash_state_ = base::MakeUnique<MashSpecificState>(); + mash_state_ = std::make_unique<MashSpecificState>(); mash_state_->pointer_watcher_event_router = pointer_watcher_event_router; mash_state_->immersive_handler_factory = - base::MakeUnique<ImmersiveHandlerFactoryMus>(); + std::make_unique<ImmersiveHandlerFactoryMus>(); } else { DCHECK_EQ(Config::MUS, GetAshConfig()); - mus_state_ = base::MakeUnique<MusSpecificState>(); + mus_state_ = std::make_unique<MusSpecificState>(); } } @@ -120,7 +121,7 @@ std::unique_ptr<display::TouchTransformSetter> ShellPortMash::CreateTouchTransformDelegate() { - return base::MakeUnique<TouchTransformSetterMus>( + return std::make_unique<TouchTransformSetterMus>( window_manager_->connector()); } @@ -194,14 +195,14 @@ return base::WrapUnique(ash::DragWindowResizer::Create( next_window_resizer.release(), window_state)); } - return base::MakeUnique<ash::mus::DragWindowResizer>( + return std::make_unique<ash::mus::DragWindowResizer>( std::move(next_window_resizer), window_state); } std::unique_ptr<WindowCycleEventFilter> ShellPortMash::CreateWindowCycleEventFilter() { if (GetAshConfig() == Config::MUS) - return base::MakeUnique<WindowCycleEventFilterClassic>(); + return std::make_unique<WindowCycleEventFilterClassic>(); // TODO: implement me, http://crbug.com/629191. return nullptr; @@ -210,7 +211,7 @@ std::unique_ptr<wm::TabletModeEventHandler> ShellPortMash::CreateTabletModeEventHandler() { if (GetAshConfig() == Config::MUS) - return base::MakeUnique<wm::TabletModeEventHandlerClassic>(); + return std::make_unique<wm::TabletModeEventHandlerClassic>(); // TODO: need support for window manager to get events before client: // http://crbug.com/624157. @@ -221,14 +222,14 @@ std::unique_ptr<WorkspaceEventHandler> ShellPortMash::CreateWorkspaceEventHandler(aura::Window* workspace_window) { if (GetAshConfig() == Config::MUS) - return base::MakeUnique<WorkspaceEventHandlerClassic>(workspace_window); + return std::make_unique<WorkspaceEventHandlerClassic>(workspace_window); - return base::MakeUnique<WorkspaceEventHandlerMus>(workspace_window); + return std::make_unique<WorkspaceEventHandlerMus>(workspace_window); } std::unique_ptr<ImmersiveFullscreenController> ShellPortMash::CreateImmersiveFullscreenController() { - return base::MakeUnique<ImmersiveFullscreenController>(); + return std::make_unique<ImmersiveFullscreenController>(); } std::unique_ptr<KeyboardUI> ShellPortMash::CreateKeyboardUI() { @@ -302,14 +303,14 @@ // Config::MASH. if (GetAshConfig() == Config::MUS) { mus_state_->pointer_watcher_adapter = - base::MakeUnique<PointerWatcherAdapterClassic>(); + std::make_unique<PointerWatcherAdapterClassic>(); } } std::unique_ptr<AshWindowTreeHost> ShellPortMash::CreateAshWindowTreeHost( const AshWindowTreeHostInitParams& init_params) { std::unique_ptr<aura::DisplayInitParams> display_params = - base::MakeUnique<aura::DisplayInitParams>(); + std::make_unique<aura::DisplayInitParams>(); display_params->viewport_metrics.bounds_in_pixels = init_params.initial_bounds; display_params->viewport_metrics.device_scale_factor = @@ -321,7 +322,7 @@ init_params.display_id); if (mirrored_display.is_valid()) { display_params->display = - base::MakeUnique<display::Display>(mirrored_display); + std::make_unique<display::Display>(mirrored_display); } display_params->is_primary_display = true; aura::WindowTreeHostMusInitParams aura_init_params = @@ -329,7 +330,7 @@ aura_init_params.display_id = init_params.display_id; aura_init_params.display_init_params = std::move(display_params); aura_init_params.use_classic_ime = !Shell::ShouldUseIMEService(); - return base::MakeUnique<AshWindowTreeHostMus>(std::move(aura_init_params)); + return std::make_unique<AshWindowTreeHostMus>(std::move(aura_init_params)); } void ShellPortMash::OnCreatedRootWindowContainers( @@ -361,7 +362,7 @@ } void ShellPortMash::OnHostsInitialized() { - display_synchronizer_ = base::MakeUnique<DisplaySynchronizer>( + display_synchronizer_ = std::make_unique<DisplaySynchronizer>( window_manager_->window_manager_client()); } @@ -372,7 +373,7 @@ window_manager_->connector()->BindInterface(ui::mojom::kServiceName, &native_display_delegate); } - return base::MakeUnique<display::ForwardingDisplayDelegate>( + return std::make_unique<display::ForwardingDisplayDelegate>( std::move(native_display_delegate)); } @@ -381,8 +382,8 @@ if (GetAshConfig() == Config::MUS) { DCHECK(!mus_state_->accelerator_controller_delegate); mus_state_->accelerator_controller_delegate = - base::MakeUnique<AcceleratorControllerDelegateClassic>(); - return base::MakeUnique<AcceleratorController>( + std::make_unique<AcceleratorControllerDelegateClassic>(); + return std::make_unique<AcceleratorController>( mus_state_->accelerator_controller_delegate.get(), nullptr); } @@ -396,11 +397,11 @@ DCHECK(add_result); mash_state_->accelerator_controller_delegate = - base::MakeUnique<AcceleratorControllerDelegateMus>(window_manager_); + std::make_unique<AcceleratorControllerDelegateMus>(window_manager_); mash_state_->accelerator_controller_registrar = base ::MakeUnique<AcceleratorControllerRegistrar>( window_manager_, accelerator_namespace_id); - return base::MakeUnique<AcceleratorController>( + return std::make_unique<AcceleratorController>( mash_state_->accelerator_controller_delegate.get(), mash_state_->accelerator_controller_registrar.get()); }
diff --git a/ash/mus/frame/detached_title_area_renderer.cc b/ash/mus/frame/detached_title_area_renderer.cc index f0b500f..bd0034b 100644 --- a/ash/mus/frame/detached_title_area_renderer.cc +++ b/ash/mus/frame/detached_title_area_renderer.cc
@@ -4,6 +4,8 @@ #include "ash/mus/frame/detached_title_area_renderer.h" +#include <memory> + #include "ash/frame/header_view.h" #include "ash/mus/property_util.h" #include "ash/mus/window_manager.h" @@ -39,7 +41,7 @@ std::unique_ptr<views::Widget::InitParams> CreateInitParams( const char* debug_name) { std::unique_ptr<views::Widget::InitParams> params = - base::MakeUnique<views::Widget::InitParams>( + std::make_unique<views::Widget::InitParams>( views::Widget::InitParams::TYPE_POPUP); params->name = debug_name; params->activatable = views::Widget::InitParams::ACTIVATABLE_NO; @@ -74,7 +76,7 @@ DetachedTitleAreaRendererForInternal::DetachedTitleAreaRendererForInternal( views::Widget* frame) - : widget_(base::MakeUnique<views::Widget>()) { + : widget_(std::make_unique<views::Widget>()) { std::unique_ptr<views::Widget::InitParams> params = CreateInitParams("DetachedTitleAreaRendererForInternal"); params->ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
diff --git a/ash/mus/keyboard_ui_mus.cc b/ash/mus/keyboard_ui_mus.cc index c187f66a..5f4c1a6 100644 --- a/ash/mus/keyboard_ui_mus.cc +++ b/ash/mus/keyboard_ui_mus.cc
@@ -4,8 +4,9 @@ #include "ash/mus/keyboard_ui_mus.h" +#include <memory> + #include "ash/keyboard/keyboard_ui_observer.h" -#include "base/memory/ptr_util.h" #include "services/service_manager/public/cpp/connector.h" namespace ash { @@ -21,7 +22,7 @@ // static std::unique_ptr<KeyboardUI> KeyboardUIMus::Create( service_manager::Connector* connector) { - return base::MakeUnique<KeyboardUIMus>(connector); + return std::make_unique<KeyboardUIMus>(connector); } void KeyboardUIMus::Hide() {
diff --git a/ash/mus/non_client_frame_controller.cc b/ash/mus/non_client_frame_controller.cc index 4ad963d..d07728e 100644 --- a/ash/mus/non_client_frame_controller.cc +++ b/ash/mus/non_client_frame_controller.cc
@@ -23,7 +23,6 @@ #include "ash/wm/window_properties.h" #include "ash/wm/window_util.h" #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/strings/utf_string_conversions.h" #include "services/ui/public/interfaces/window_manager.mojom.h" #include "ui/aura/client/aura_constants.h" @@ -138,7 +137,7 @@ NonClientFrameController::GetPreferredClientAreaInsets().top()); bounds.set_y(bounds.y() - bounds.height()); title_area_renderer_ = - base::MakeUnique<DetachedTitleAreaRendererForInternal>(frame_); + std::make_unique<DetachedTitleAreaRendererForInternal>(frame_); title_area_renderer_->widget()->SetBounds(bounds); title_area_renderer_->widget()->ShowInactive(); } @@ -192,7 +191,7 @@ // views::NativeWidgetAura: views::NonClientFrameView* CreateNonClientFrameView() override { - move_event_handler_ = base::MakeUnique<MoveEventHandler>( + move_event_handler_ = std::make_unique<MoveEventHandler>( window_manager_client_, GetNativeView()); // TODO(sky): investigate why we have this. Seems this should be the same // as not specifying client area insets. @@ -203,7 +202,7 @@ ui::mojom::WindowType::PANEL) return new PanelFrameView(GetWidget(), PanelFrameView::FRAME_ASH); immersive_delegate_ = - base::MakeUnique<ImmersiveFullscreenControllerDelegateMus>(GetWidget(), + std::make_unique<ImmersiveFullscreenControllerDelegateMus>(GetWidget(), window); // See description for details on ownership. custom_frame_view_ =
diff --git a/ash/mus/shell_delegate_mus.cc b/ash/mus/shell_delegate_mus.cc index fbb332e..83e731e 100644 --- a/ash/mus/shell_delegate_mus.cc +++ b/ash/mus/shell_delegate_mus.cc
@@ -4,13 +4,13 @@ #include "ash/mus/shell_delegate_mus.h" +#include <memory> #include <utility> #include "ash/accessibility/default_accessibility_delegate.h" #include "ash/gpu_support_stub.h" #include "ash/mus/wallpaper_delegate_mus.h" #include "ash/palette_delegate.h" -#include "base/memory/ptr_util.h" #include "base/strings/string16.h" #include "base/strings/string_util.h" #include "components/user_manager/user_info_impl.h" @@ -69,7 +69,7 @@ } std::unique_ptr<WallpaperDelegate> ShellDelegateMus::CreateWallpaperDelegate() { - return base::MakeUnique<WallpaperDelegateMus>(); + return std::make_unique<WallpaperDelegateMus>(); } AccessibilityDelegate* ShellDelegateMus::CreateAccessibilityDelegate() { @@ -105,7 +105,7 @@ if (!input_device_controller_client_) { input_device_controller_client_ = - base::MakeUnique<ui::InputDeviceControllerClient>(connector_); + std::make_unique<ui::InputDeviceControllerClient>(connector_); } return input_device_controller_client_.get(); }
diff --git a/ash/mus/standalone/ash_standalone_main.cc b/ash/mus/standalone/ash_standalone_main.cc index 27509a6..6fc7776 100644 --- a/ash/mus/standalone/ash_standalone_main.cc +++ b/ash/mus/standalone/ash_standalone_main.cc
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <memory> + #include "ash/mus/window_manager_application.h" #include "ash/shell.h" #include "ash/shell/example_app_list_presenter.h" @@ -13,7 +15,6 @@ #include "ash/shell_observer.h" #include "base/bind.h" #include "base/bind_helpers.h" -#include "base/memory/ptr_util.h" #include "services/service_manager/public/c/main.h" #include "services/service_manager/public/cpp/connector.h" #include "services/service_manager/public/cpp/service_runner.h" @@ -34,7 +35,7 @@ class ShellInit : public shell::ShellDelegateImpl, public ShellObserver { public: ShellInit() - : input_device_client_(base::MakeUnique<ui::InputDeviceClient>()) {} + : input_device_client_(std::make_unique<ui::InputDeviceClient>()) {} ~ShellInit() override = default; void set_window_manager_app(mus::WindowManagerApplication* app) { @@ -60,16 +61,16 @@ // Initialize session controller client and create fake user sessions. The // fake user sessions makes ash into the logged in state. example_session_controller_client_ = - base::MakeUnique<shell::ExampleSessionControllerClient>( + std::make_unique<shell::ExampleSessionControllerClient>( Shell::Get()->session_controller()); example_session_controller_client_->Initialize(); - window_watcher_ = base::MakeUnique<shell::WindowWatcher>(); + window_watcher_ = std::make_unique<shell::WindowWatcher>(); shell::InitWindowTypeLauncher(base::Bind(&ShowViewsExamples)); // Initialize the example app list presenter. example_app_list_presenter_ = - base::MakeUnique<shell::ExampleAppListPresenter>(); + std::make_unique<shell::ExampleAppListPresenter>(); Shell::Get()->app_list()->SetAppListPresenter( example_app_list_presenter_->CreateInterfacePtrAndBind()); @@ -95,7 +96,7 @@ ash::shell::ShellViewsDelegate shell_views_delegate; const bool show_primary_host_on_connect = false; std::unique_ptr<ash::ShellInit> shell_init_ptr = - base::MakeUnique<ash::ShellInit>(); + std::make_unique<ash::ShellInit>(); ash::ShellInit* shell_init = shell_init_ptr.get(); ash::mus::WindowManagerApplication* window_manager_app = new ash::mus::WindowManagerApplication(show_primary_host_on_connect,
diff --git a/ash/mus/window_manager.cc b/ash/mus/window_manager.cc index 09ebe46..7f76eb3 100644 --- a/ash/mus/window_manager.cc +++ b/ash/mus/window_manager.cc
@@ -7,6 +7,7 @@ #include <stdint.h> #include <limits> +#include <memory> #include <utility> #include "ash/drag_drop/drag_image_view.h" @@ -35,7 +36,6 @@ #include "ash/wayland/wayland_server_controller.h" #include "ash/wm/ash_focus_rules.h" #include "ash/wm/window_state.h" -#include "base/memory/ptr_util.h" #include "services/service_manager/public/cpp/connector.h" #include "services/ui/common/accelerator_util.h" #include "services/ui/common/types.h" @@ -81,8 +81,8 @@ : connector_(connector), config_(config), show_primary_host_on_connect_(show_primary_host_on_connect), - wm_state_(base::MakeUnique<::wm::WMState>()), - property_converter_(base::MakeUnique<aura::PropertyConverter>()) { + wm_state_(std::make_unique<::wm::WMState>()), + property_converter_(std::make_unique<aura::PropertyConverter>()) { property_converter_->RegisterPrimitiveProperty( kPanelAttachedKey, ui::mojom::WindowManager::kPanelAttached_Property, aura::PropertyConverter::CreateAcceptAnyValueCallback()); @@ -119,7 +119,7 @@ // Only create InputDeviceClient in MASH mode. For MUS mode WindowManager is // created by chrome, which creates InputDeviceClient. if (config_ == Config::MASH) { - input_device_client_ = base::MakeUnique<ui::InputDeviceClient>(); + input_device_client_ = std::make_unique<ui::InputDeviceClient>(); // |connector_| can be nullptr in tests. if (connector_) { @@ -140,7 +140,7 @@ ash::Shell::set_window_tree_client(window_tree_client_.get()); pointer_watcher_event_router_ = - base::MakeUnique<views::PointerWatcherEventRouter>( + std::make_unique<views::PointerWatcherEventRouter>( window_tree_client_.get()); // Notify PointerWatcherEventRouter and CaptureSynchronizer that the capture @@ -393,14 +393,14 @@ ? ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE : ui::DragDropTypes::DRAG_EVENT_SOURCE_TOUCH; std::unique_ptr<DragImageView> drag_view = - base::MakeUnique<DragImageView>(root_window, ui_source); + std::make_unique<DragImageView>(root_window, ui_source); drag_view->SetImage(gfx::ImageSkia::CreateFrom1xBitmap(drag_image)); gfx::Size size = drag_view->GetPreferredSize(); gfx::Rect drag_image_bounds(screen_location - drag_image_offset, size); drag_view->SetBoundsInScreen(drag_image_bounds); drag_view->SetWidgetVisible(true); - drag_state_ = base::MakeUnique<DragState>(); + drag_state_ = std::make_unique<DragState>(); drag_state_->view = std::move(drag_view); drag_state_->image_offset = drag_image_offset; }
diff --git a/ash/mus/window_manager_application.cc b/ash/mus/window_manager_application.cc index 1ac4f34..8b88f64c 100644 --- a/ash/mus/window_manager_application.cc +++ b/ash/mus/window_manager_application.cc
@@ -4,6 +4,7 @@ #include "ash/mus/window_manager_application.h" +#include <memory> #include <utility> #include "ash/mojo_interface_factory.h" @@ -14,7 +15,6 @@ #include "ash/shell_delegate.h" #include "ash/system/power/power_status.h" #include "base/bind.h" -#include "base/memory/ptr_util.h" #include "base/threading/sequenced_worker_pool.h" #include "base/threading/thread_task_runner_handle.h" #include "chromeos/audio/cras_audio_handler.h" @@ -138,11 +138,11 @@ context()->QuitNow(); return; } - window_manager_ = base::MakeUnique<WindowManager>( + window_manager_ = std::make_unique<WindowManager>( context()->connector(), ash_config_, show_primary_host_on_connect_); std::unique_ptr<aura::WindowTreeClient> window_tree_client = - base::MakeUnique<aura::WindowTreeClient>( + std::make_unique<aura::WindowTreeClient>( context()->connector(), window_manager_.get(), window_manager_.get()); const bool automatically_create_display_roots = false; window_tree_client->ConnectAsWindowManager(
diff --git a/ash/perftests/ash_background_filter_blur_perftest.cc b/ash/perftests/ash_background_filter_blur_perftest.cc index ee2c93f..8562539 100644 --- a/ash/perftests/ash_background_filter_blur_perftest.cc +++ b/ash/perftests/ash_background_filter_blur_perftest.cc
@@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <memory> + #include "ash/shell.h" #include "ash/test/ash_test_base.h" -#include "base/memory/ptr_util.h" #include "cc/base/lap_timer.h" #include "testing/perf/perf_test.h" #include "ui/aura/window.h" @@ -63,7 +64,7 @@ std::unique_ptr<ui::Layer> AshBackgroundFilterBlurPerfTest::CreateSolidColorLayer(SkColor color) { std::unique_ptr<ui::Layer> layer = - base::MakeUnique<ui::Layer>(ui::LAYER_SOLID_COLOR); + std::make_unique<ui::Layer>(ui::LAYER_SOLID_COLOR); layer->SetBounds(root_layer_->bounds()); layer->SetColor(color); root_layer_->Add(layer.get());
diff --git a/ash/public/cpp/remote_shelf_item_delegate.cc b/ash/public/cpp/remote_shelf_item_delegate.cc index 6090e930..b28d04d 100644 --- a/ash/public/cpp/remote_shelf_item_delegate.cc +++ b/ash/public/cpp/remote_shelf_item_delegate.cc
@@ -4,6 +4,8 @@ #include "ash/public/cpp/remote_shelf_item_delegate.h" +#include <memory> + namespace ash { RemoteShelfItemDelegate::RemoteShelfItemDelegate( @@ -20,9 +22,9 @@ // Mojo requires conversion of mouse and touch events to pointer events. if (event && ui::PointerEvent::CanConvertFrom(*event.get())) { if (event->IsMouseEvent()) - event = base::MakeUnique<ui::PointerEvent>(*event->AsMouseEvent()); + event = std::make_unique<ui::PointerEvent>(*event->AsMouseEvent()); else if (event->IsTouchEvent()) - event = base::MakeUnique<ui::PointerEvent>(*event->AsTouchEvent()); + event = std::make_unique<ui::PointerEvent>(*event->AsTouchEvent()); else NOTREACHED() << "Need conversion of event to pointer event."; }
diff --git a/ash/public/cpp/shelf_prefs.cc b/ash/public/cpp/shelf_prefs.cc index 2b5d95e..89715f1 100644 --- a/ash/public/cpp/shelf_prefs.cc +++ b/ash/public/cpp/shelf_prefs.cc
@@ -4,8 +4,9 @@ #include "ash/public/cpp/shelf_prefs.h" +#include <memory> + #include "ash/public/cpp/ash_pref_names.h" -#include "base/memory/ptr_util.h" #include "base/strings/string_number_conversions.h" #include "base/values.h" #include "components/prefs/pref_service.h" @@ -108,7 +109,7 @@ base::DictionaryValue* shelf_prefs = update.Get(); base::DictionaryValue* display_prefs_weak = nullptr; if (!shelf_prefs->GetDictionary(display_key, &display_prefs_weak)) { - auto display_prefs = base::MakeUnique<base::DictionaryValue>(); + auto display_prefs = std::make_unique<base::DictionaryValue>(); display_prefs_weak = display_prefs.get(); shelf_prefs->Set(display_key, std::move(display_prefs)); }
diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc index 8f6f88f..cf7f2a97 100644 --- a/ash/root_window_controller.cc +++ b/ash/root_window_controller.cc
@@ -5,6 +5,7 @@ #include "ash/root_window_controller.h" #include <algorithm> +#include <memory> #include <queue> #include <vector> @@ -55,7 +56,6 @@ #include "ash/wm/workspace_controller.h" #include "base/command_line.h" #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/time/time.h" #include "chromeos/chromeos_switches.h" #include "ui/aura/client/aura_constants.h" @@ -634,10 +634,10 @@ const int64_t display_id = display::Screen::GetScreen() ->GetDisplayNearestWindow(GetRootWindow()) .id(); - menu_model_ = base::MakeUnique<ShelfContextMenuModel>( + menu_model_ = std::make_unique<ShelfContextMenuModel>( std::vector<mojom::MenuItemPtr>(), nullptr, display_id); - menu_model_adapter_ = base::MakeUnique<views::MenuModelAdapter>( + menu_model_adapter_ = std::make_unique<views::MenuModelAdapter>( menu_model_.get(), base::Bind(&RootWindowController::OnMenuClosed, base::Unretained(this))); @@ -646,7 +646,7 @@ if (!wallpaper_widget_controller()) return; - menu_runner_ = base::MakeUnique<views::MenuRunner>( + menu_runner_ = std::make_unique<views::MenuRunner>( menu_model_adapter_->CreateMenu(), views::MenuRunner::CONTEXT_MENU); menu_runner_->RunMenuAt(wallpaper_widget_controller()->widget(), nullptr, gfx::Rect(location_in_screen, gfx::Size()), @@ -670,7 +670,7 @@ mus_window_tree_host_(window_tree_host), window_tree_host_(ash_host ? ash_host->AsWindowTreeHost() : window_tree_host), - shelf_(base::MakeUnique<Shelf>()) { + shelf_(std::make_unique<Shelf>()) { DCHECK((ash_host && !window_tree_host) || (!ash_host && window_tree_host)); if (!root_window_controllers_) @@ -773,7 +773,7 @@ GetContainer(kShellWindowId_AlwaysOnTopContainer); DCHECK(always_on_top_container); always_on_top_controller_ = - base::MakeUnique<AlwaysOnTopController>(always_on_top_container); + std::make_unique<AlwaysOnTopController>(always_on_top_container); // Create Panel layout manager aura::Window* panel_container = GetContainer(kShellWindowId_PanelContainer); @@ -786,12 +786,12 @@ // occur after the ShelfLayoutManager is constructed by ShelfWidget. aura::Window* shelf_container = GetContainer(kShellWindowId_ShelfContainer); shelf_container->SetEventTargeter( - base::MakeUnique<ShelfWindowTargeter>(shelf_container, shelf_.get())); + std::make_unique<ShelfWindowTargeter>(shelf_container, shelf_.get())); aura::Window* status_container = GetContainer(kShellWindowId_StatusContainer); status_container->SetEventTargeter( - base::MakeUnique<ShelfWindowTargeter>(status_container, shelf_.get())); + std::make_unique<ShelfWindowTargeter>(status_container, shelf_.get())); - panel_container_handler_ = base::MakeUnique<PanelWindowEventHandler>(); + panel_container_handler_ = std::make_unique<PanelWindowEventHandler>(); GetContainer(kShellWindowId_PanelContainer) ->AddPreTargetHandler(panel_container_handler_.get());
diff --git a/ash/rotator/screen_rotation_animation.cc b/ash/rotator/screen_rotation_animation.cc index 9e73b86..de1f81b6 100644 --- a/ash/rotator/screen_rotation_animation.cc +++ b/ash/rotator/screen_rotation_animation.cc
@@ -4,7 +4,8 @@ #include "ash/rotator/screen_rotation_animation.h" -#include "base/memory/ptr_util.h" +#include <memory> + #include "base/time/time.h" #include "ui/compositor/layer.h" #include "ui/compositor/layer_animation_delegate.h" @@ -30,8 +31,8 @@ initial_opacity_(initial_opacity), target_opacity_(target_opacity) { std::unique_ptr<ui::InterpolatedTransform> rotation = - base::MakeUnique<ui::InterpolatedTransformAboutPivot>( - pivot, base::MakeUnique<ui::InterpolatedRotation>(start_degrees, + std::make_unique<ui::InterpolatedTransformAboutPivot>( + pivot, std::make_unique<ui::InterpolatedRotation>(start_degrees, end_degrees)); // Use the target transform/bounds in case the layer is already animating.
diff --git a/ash/rotator/screen_rotation_animation_unittest.cc b/ash/rotator/screen_rotation_animation_unittest.cc index c4efaa0..962a695 100644 --- a/ash/rotator/screen_rotation_animation_unittest.cc +++ b/ash/rotator/screen_rotation_animation_unittest.cc
@@ -8,7 +8,6 @@ #include "ash/test/ash_test_base.h" #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/time/time.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/aura/window.h" @@ -46,7 +45,7 @@ ui::Layer* layer = window->layer(); std::unique_ptr<ScreenRotationAnimation> screen_rotation = - base::MakeUnique<ScreenRotationAnimation>( + std::make_unique<ScreenRotationAnimation>( layer, 45 /* start_degrees */, 0 /* end_degrees */, 0.5f /* initial_opacity */, 1.0f /* target_opacity */, gfx::Point(10, 10) /* pivot */, @@ -56,7 +55,7 @@ animator->set_preemption_strategy( ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); std::unique_ptr<ui::LayerAnimationSequence> animation_sequence = - base::MakeUnique<ui::LayerAnimationSequence>(std::move(screen_rotation)); + std::make_unique<ui::LayerAnimationSequence>(std::move(screen_rotation)); animator->StartAnimation(animation_sequence.release()); const gfx::Transform identity_transform; @@ -75,19 +74,19 @@ TEST_F(ScreenRotationAnimationTest, DestroyLayerDuringAnimation) { // Create a ui::Layer directly rather than an aura::Window, as the latter // finishes all of its animation before destroying its layer. - std::unique_ptr<ui::Layer> layer = base::MakeUnique<ui::Layer>(); + std::unique_ptr<ui::Layer> layer = std::make_unique<ui::Layer>(); ui::Layer* root_layer = CurrentContext()->layer(); layer->SetBounds(gfx::Rect(root_layer->bounds().size())); root_layer->Add(layer.get()); std::unique_ptr<ScreenRotationAnimation> screen_rotation = - base::MakeUnique<ScreenRotationAnimation>( + std::make_unique<ScreenRotationAnimation>( layer.get(), 45, 0, 1.0f, 1.0f, gfx::Point(), base::TimeDelta::FromSeconds(1), gfx::Tween::LINEAR); ui::LayerAnimator* animator = layer->GetAnimator(); std::unique_ptr<ui::LayerAnimationSequence> animation_sequence = - base::MakeUnique<ui::LayerAnimationSequence>(std::move(screen_rotation)); + std::make_unique<ui::LayerAnimationSequence>(std::move(screen_rotation)); animator->StartAnimation(animation_sequence.release()); // Explicitly destroy the layer to verify that the animation doesn't crash.
diff --git a/ash/rotator/screen_rotation_animator.cc b/ash/rotator/screen_rotation_animator.cc index 5b7196b..d49f367 100644 --- a/ash/rotator/screen_rotation_animator.cc +++ b/ash/rotator/screen_rotation_animator.cc
@@ -4,6 +4,8 @@ #include "ash/rotator/screen_rotation_animator.h" +#include <memory> + #include "ash/public/cpp/ash_switches.h" #include "ash/public/cpp/shell_window_ids.h" #include "ash/rotator/screen_rotation_animation.h" @@ -11,7 +13,6 @@ #include "ash/shell.h" #include "ash/utility/transformer_util.h" #include "base/command_line.h" -#include "base/memory/ptr_util.h" #include "base/metrics/histogram_macros.h" #include "base/time/time.h" #include "components/viz/common/frame_sinks/copy_output_request.h" @@ -134,10 +135,10 @@ std::unique_ptr<ui::LayerTreeOwner> CreateMaskLayerTreeOwner( const gfx::Rect& rect) { std::unique_ptr<ui::Layer> mask_layer = - base::MakeUnique<ui::Layer>(ui::LAYER_SOLID_COLOR); + std::make_unique<ui::Layer>(ui::LAYER_SOLID_COLOR); mask_layer->SetBounds(rect); mask_layer->SetColor(SK_ColorBLACK); - return base::MakeUnique<ui::LayerTreeOwner>(std::move(mask_layer)); + return std::make_unique<ui::LayerTreeOwner>(std::move(mask_layer)); } class ScreenRotationAnimationMetricsReporter @@ -161,7 +162,7 @@ screen_rotation_state_(IDLE), rotation_request_id_(0), metrics_reporter_( - base::MakeUnique<ScreenRotationAnimationMetricsReporter>()), + std::make_unique<ScreenRotationAnimationMetricsReporter>()), disable_animation_timers_for_test_(false), // TODO(wutao): remove the flag. http://crbug.com/707800. has_switch_ash_disable_smooth_screen_rotation_( @@ -349,11 +350,11 @@ DCHECK(texture_mailbox.IsTexture()); const gfx::Rect rect( GetScreenRotationContainer(root_window_)->layer()->size()); - std::unique_ptr<ui::Layer> copy_layer = base::MakeUnique<ui::Layer>(); + std::unique_ptr<ui::Layer> copy_layer = std::make_unique<ui::Layer>(); copy_layer->SetBounds(rect); copy_layer->SetTextureMailbox(texture_mailbox, std::move(release_callback), rect.size()); - return base::MakeUnique<ui::LayerTreeOwner>(std::move(copy_layer)); + return std::make_unique<ui::LayerTreeOwner>(std::move(copy_layer)); } void ScreenRotationAnimator::AnimateRotation( @@ -386,7 +387,7 @@ } std::unique_ptr<ScreenRotationAnimation> new_layer_screen_rotation = - base::MakeUnique<ScreenRotationAnimation>( + std::make_unique<ScreenRotationAnimation>( new_root_layer, kRotationDegrees * rotation_factor, 0 /* end_degrees */, new_root_layer->opacity(), new_root_layer->opacity() /* target_opacity */, pivot, duration, @@ -396,7 +397,7 @@ new_layer_animator->set_preemption_strategy( ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); std::unique_ptr<ui::LayerAnimationSequence> new_layer_animation_sequence = - base::MakeUnique<ui::LayerAnimationSequence>( + std::make_unique<ui::LayerAnimationSequence>( std::move(new_layer_screen_rotation)); ui::Layer* old_root_layer = old_layer_tree_owner_->root(); @@ -412,7 +413,7 @@ old_root_layer->SetTransform(translate_transform); std::unique_ptr<ScreenRotationAnimation> old_layer_screen_rotation = - base::MakeUnique<ScreenRotationAnimation>( + std::make_unique<ScreenRotationAnimation>( old_root_layer, old_layer_initial_rotation_degrees * rotation_factor, (old_layer_initial_rotation_degrees - kRotationDegrees) * rotation_factor, @@ -423,7 +424,7 @@ old_layer_animator->set_preemption_strategy( ui::LayerAnimator::REPLACE_QUEUED_ANIMATIONS); std::unique_ptr<ui::LayerAnimationSequence> old_layer_animation_sequence = - base::MakeUnique<ui::LayerAnimationSequence>( + std::make_unique<ui::LayerAnimationSequence>( std::move(old_layer_screen_rotation)); // In unit tests, we can use ash::ScreenRotationAnimatorTestApi to control the @@ -462,7 +463,7 @@ const int64_t display_id = display::Screen::GetScreen()->GetDisplayNearestWindow(root_window_).id(); std::unique_ptr<ScreenRotationRequest> rotation_request = - base::MakeUnique<ScreenRotationRequest>(rotation_request_id_, display_id, + std::make_unique<ScreenRotationRequest>(rotation_request_id_, display_id, new_rotation, source, mode); target_rotation_ = new_rotation; switch (screen_rotation_state_) {
diff --git a/ash/rotator/screen_rotation_animator_unittest.cc b/ash/rotator/screen_rotation_animator_unittest.cc index e363c3b..4bed9dd 100644 --- a/ash/rotator/screen_rotation_animator_unittest.cc +++ b/ash/rotator/screen_rotation_animator_unittest.cc
@@ -4,6 +4,8 @@ #include "ash/rotator/screen_rotation_animator.h" +#include <memory> + #include "ash/display/screen_orientation_controller_chromeos.h" #include "ash/display/window_tree_host_manager.h" #include "ash/public/cpp/ash_switches.h" @@ -19,7 +21,6 @@ #include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "base/callback_forward.h" #include "base/command_line.h" -#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "components/viz/common/frame_sinks/copy_output_request.h" #include "components/viz/common/frame_sinks/copy_output_result.h" @@ -168,12 +169,12 @@ AshTestBase::SetUp(); display_ = display::Screen::GetScreen()->GetPrimaryDisplay(); - animator_ = base::MakeUnique<ScreenRotationAnimator>( + animator_ = std::make_unique<ScreenRotationAnimator>( Shell::GetRootWindowForDisplayId(display_.id())); - test_api_ = base::MakeUnique<ScreenRotationAnimatorTestApi>(animator_.get()); + test_api_ = std::make_unique<ScreenRotationAnimatorTestApi>(animator_.get()); test_api()->DisableAnimationTimers(); non_zero_duration_mode_ = - base::MakeUnique<ui::ScopedAnimationDurationScaleMode>( + std::make_unique<ui::ScopedAnimationDurationScaleMode>( ui::ScopedAnimationDurationScaleMode::SLOW_DURATION); } @@ -233,12 +234,12 @@ ash_test_helper()->reset_commandline(); display_ = display::Screen::GetScreen()->GetPrimaryDisplay(); - run_loop_ = base::MakeUnique<base::RunLoop>(); + run_loop_ = std::make_unique<base::RunLoop>(); SetScreenRotationAnimator(Shell::GetRootWindowForDisplayId(display_.id()), run_loop_->QuitWhenIdleClosure(), run_loop_->QuitWhenIdleClosure()); non_zero_duration_mode_ = - base::MakeUnique<ui::ScopedAnimationDurationScaleMode>( + std::make_unique<ui::ScopedAnimationDurationScaleMode>( ui::ScopedAnimationDurationScaleMode::SLOW_DURATION); } @@ -246,9 +247,9 @@ aura::Window* root_window, const base::Closure& before_callback, const base::Closure& after_callback) { - animator_ = base::MakeUnique<TestScreenRotationAnimator>( + animator_ = std::make_unique<TestScreenRotationAnimator>( root_window, before_callback, after_callback); - test_api_ = base::MakeUnique<ScreenRotationAnimatorTestApi>(animator_.get()); + test_api_ = std::make_unique<ScreenRotationAnimatorTestApi>(animator_.get()); test_api()->DisableAnimationTimers(); }
diff --git a/ash/rotator/window_rotation.cc b/ash/rotator/window_rotation.cc index 94ee05ac..3a7b6e4 100644 --- a/ash/rotator/window_rotation.cc +++ b/ash/rotator/window_rotation.cc
@@ -4,7 +4,8 @@ #include "ash/rotator/window_rotation.h" -#include "base/memory/ptr_util.h" +#include <memory> + #include "base/time/time.h" #include "ui/compositor/layer.h" #include "ui/gfx/geometry/rect.h" @@ -78,20 +79,20 @@ current_transform.TransformPoint(&new_origin_); std::unique_ptr<ui::InterpolatedTransform> rotation = - base::MakeUnique<ui::InterpolatedTransformAboutPivot>( - old_pivot, base::MakeUnique<ui::InterpolatedRotation>(0, degrees_)); + std::make_unique<ui::InterpolatedTransformAboutPivot>( + old_pivot, std::make_unique<ui::InterpolatedRotation>(0, degrees_)); std::unique_ptr<ui::InterpolatedTransform> translation = - base::MakeUnique<ui::InterpolatedTranslation>( + std::make_unique<ui::InterpolatedTranslation>( gfx::PointF(), gfx::PointF(new_pivot.x() - old_pivot.x(), new_pivot.y() - old_pivot.y())); float scale_factor = 0.9f; std::unique_ptr<ui::InterpolatedTransform> scale_down = - base::MakeUnique<ui::InterpolatedScale>(1.0f, scale_factor, 0.0f, 0.5f); + std::make_unique<ui::InterpolatedScale>(1.0f, scale_factor, 0.0f, 0.5f); std::unique_ptr<ui::InterpolatedTransform> scale_up = - base::MakeUnique<ui::InterpolatedScale>(1.0f, 1.0f / scale_factor, 0.5f, + std::make_unique<ui::InterpolatedScale>(1.0f, 1.0f / scale_factor, 0.5f, 1.0f); interpolated_transform_.reset(
diff --git a/ash/session/session_controller_unittest.cc b/ash/session/session_controller_unittest.cc index 17f77e9f..e5650641 100644 --- a/ash/session/session_controller_unittest.cc +++ b/ash/session/session_controller_unittest.cc
@@ -23,7 +23,6 @@ #include "ash/wm/window_util.h" #include "base/callback.h" #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "base/threading/thread_task_runner_handle.h" #include "components/prefs/testing_pref_service.h" @@ -100,7 +99,7 @@ // testing::Test: void SetUp() override { - controller_ = base::MakeUnique<SessionController>(nullptr); + controller_ = std::make_unique<SessionController>(nullptr); controller_->AddObserver(&observer_); } @@ -445,7 +444,7 @@ session->SwitchActiveUser(kUserAccount1); EXPECT_EQ(nullptr, observer.last_user_pref_service()); - auto pref_service = base::MakeUnique<TestingPrefServiceSimple>(); + auto pref_service = std::make_unique<TestingPrefServiceSimple>(); Shell::RegisterProfilePrefs(pref_service->registry(), true /* for_test */); controller->ProvideUserPrefServiceForTest(kUserAccount1, std::move(pref_service)); @@ -472,7 +471,7 @@ // There should be no notification about a PrefService for an inactive user // becoming initialized. observer.clear_last_user_pref_service(); - pref_service = base::MakeUnique<TestingPrefServiceSimple>(); + pref_service = std::make_unique<TestingPrefServiceSimple>(); Shell::RegisterProfilePrefs(pref_service->registry(), true /* for_test */); controller->ProvideUserPrefServiceForTest(kUserAccount2, std::move(pref_service));
diff --git a/ash/session/test_session_controller_client.cc b/ash/session/test_session_controller_client.cc index d170912..10f29c3 100644 --- a/ash/session/test_session_controller_client.cc +++ b/ash/session/test_session_controller_client.cc
@@ -65,7 +65,7 @@ controller_->SetSessionInfo(session_info_->Clone()); if (!controller_->GetSigninScreenPrefService()) { - auto pref_service = base::MakeUnique<TestingPrefServiceSimple>(); + auto pref_service = std::make_unique<TestingPrefServiceSimple>(); Shell::RegisterProfilePrefs(pref_service->registry(), true /* for_test */); controller_->SetSigninScreenPrefServiceForTest(std::move(pref_service)); } @@ -134,7 +134,7 @@ if (provide_pref_service && !controller_->GetUserPrefServiceForUser(account_id)) { - auto pref_service = base::MakeUnique<TestingPrefServiceSimple>(); + auto pref_service = std::make_unique<TestingPrefServiceSimple>(); Shell::RegisterProfilePrefs(pref_service->registry(), true /* for_test */); controller_->ProvideUserPrefServiceForTest(account_id, std::move(pref_service));
diff --git a/ash/shelf/app_list_button.cc b/ash/shelf/app_list_button.cc index 346a016..4d51d17 100644 --- a/ash/shelf/app_list_button.cc +++ b/ash/shelf/app_list_button.cc
@@ -20,7 +20,6 @@ #include "ash/system/tray/tray_popup_utils.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "base/command_line.h" -#include "base/memory/ptr_util.h" #include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics_action.h" #include "base/timer/timer.h" @@ -245,7 +244,7 @@ gfx::Rect bounds(center.x() - kAppListButtonRadius, center.y() - kAppListButtonRadius, 2 * kAppListButtonRadius, 2 * kAppListButtonRadius); - return base::MakeUnique<views::FloodFillInkDropRipple>( + return std::make_unique<views::FloodFillInkDropRipple>( size(), GetLocalBounds().InsetsFrom(bounds), GetInkDropCenterBasedOnLastEvent(), GetInkDropBaseColor(), ink_drop_visible_opacity()); @@ -273,7 +272,7 @@ } std::unique_ptr<views::InkDropMask> AppListButton::CreateInkDropMask() const { - return base::MakeUnique<views::CircleInkDropMask>( + return std::make_unique<views::CircleInkDropMask>( size(), last_event_is_back_event_ ? GetBackButtonCenterPoint() : GetAppListButtonCenterPoint(), @@ -604,9 +603,9 @@ AddChildView(voice_interaction_overlay_); voice_interaction_overlay_->SetVisible(false); voice_interaction_animation_delay_timer_ = - base::MakeUnique<base::OneShotTimer>(); + std::make_unique<base::OneShotTimer>(); voice_interaction_animation_hide_delay_timer_ = - base::MakeUnique<base::OneShotTimer>(); + std::make_unique<base::OneShotTimer>(); } bool AppListButton::IsUserPrimary() {
diff --git a/ash/shelf/app_list_button_unittest.cc b/ash/shelf/app_list_button_unittest.cc index bff24bd1..1ce196d9 100644 --- a/ash/shelf/app_list_button_unittest.cc +++ b/ash/shelf/app_list_button_unittest.cc
@@ -4,6 +4,8 @@ #include "ash/shelf/app_list_button.h" +#include <memory> + #include "ash/public/cpp/config.h" #include "ash/root_window_controller.h" #include "ash/session/session_controller.h" @@ -36,7 +38,7 @@ // AshTestBase: void SetUp() override { - command_line_ = base::MakeUnique<base::test::ScopedCommandLine>(); + command_line_ = std::make_unique<base::test::ScopedCommandLine>(); SetupCommandLine(command_line_->GetProcessCommandLine()); AshTestBase::SetUp(); app_list_button_ =
diff --git a/ash/shelf/login_shelf_view.cc b/ash/shelf/login_shelf_view.cc index 70c9e31..26f0deb 100644 --- a/ash/shelf/login_shelf_view.cc +++ b/ash/shelf/login_shelf_view.cc
@@ -4,6 +4,8 @@ #include "ash/shelf/login_shelf_view.h" +#include <memory> + #include "ash/ash_constants.h" #include "ash/focus_cycler.h" #include "ash/login/lock_screen_controller.h" @@ -77,7 +79,7 @@ // views::InkDropHostView: std::unique_ptr<views::InkDrop> CreateInkDrop() override { std::unique_ptr<views::InkDropImpl> ink_drop = - base::MakeUnique<views::InkDropImpl>(this, size()); + std::make_unique<views::InkDropImpl>(this, size()); ink_drop->SetShowHighlightOnHover(false); ink_drop->SetShowHighlightOnFocus(false); return std::move(ink_drop);
diff --git a/ash/shelf/overflow_button.cc b/ash/shelf/overflow_button.cc index f8e7f9f..a368c7f 100644 --- a/ash/shelf/overflow_button.cc +++ b/ash/shelf/overflow_button.cc
@@ -4,12 +4,13 @@ #include "ash/shelf/overflow_button.h" +#include <memory> + #include "ash/resources/vector_icons/vector_icons.h" #include "ash/shelf/shelf.h" #include "ash/shelf/shelf_constants.h" #include "ash/shelf/shelf_view.h" #include "ash/strings/grit/ash_strings.h" -#include "base/memory/ptr_util.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/canvas.h" #include "ui/gfx/image/image_skia_operations.h" @@ -120,7 +121,7 @@ std::unique_ptr<views::InkDropRipple> OverflowButton::CreateInkDropRipple() const { gfx::Insets insets = GetLocalBounds().InsetsFrom(CalculateButtonBounds()); - return base::MakeUnique<views::FloodFillInkDropRipple>( + return std::make_unique<views::FloodFillInkDropRipple>( size(), insets, GetInkDropCenterBasedOnLastEvent(), GetInkDropBaseColor(), ink_drop_visible_opacity()); } @@ -139,7 +140,7 @@ std::unique_ptr<views::InkDropMask> OverflowButton::CreateInkDropMask() const { gfx::Insets insets = GetLocalBounds().InsetsFrom(CalculateButtonBounds()); - return base::MakeUnique<views::RoundRectInkDropMask>( + return std::make_unique<views::RoundRectInkDropMask>( size(), insets, kOverflowButtonCornerRadius); }
diff --git a/ash/shelf/shelf.cc b/ash/shelf/shelf.cc index fc12867..03526d0 100644 --- a/ash/shelf/shelf.cc +++ b/ash/shelf/shelf.cc
@@ -4,6 +4,8 @@ #include "ash/shelf/shelf.h" +#include <memory> + #include "ash/public/cpp/config.h" #include "ash/public/cpp/shelf_item_delegate.h" #include "ash/public/cpp/shelf_model.h" @@ -16,7 +18,6 @@ #include "ash/shelf/shelf_widget.h" #include "ash/shell.h" #include "base/logging.h" -#include "base/memory/ptr_util.h" #include "ui/app_list/presenter/app_list.h" #include "ui/display/types/display_constants.h" #include "ui/gfx/geometry/rect.h" @@ -66,7 +67,7 @@ // TODO: ShelfBezelEventHandler needs to work with mus too. // http://crbug.com/636647 if (Shell::GetAshConfig() != Config::MASH) - bezel_event_handler_ = base::MakeUnique<ShelfBezelEventHandler>(this); + bezel_event_handler_ = std::make_unique<ShelfBezelEventHandler>(this); } Shelf::~Shelf() {} @@ -253,7 +254,7 @@ ShelfModel* shelf_model = Shell::Get()->shelf_model(); const ShelfItem& item = shelf_model->items()[item_index]; ShelfItemDelegate* item_delegate = shelf_model->GetShelfItemDelegate(item.id); - std::unique_ptr<ui::Event> event = base::MakeUnique<ui::KeyEvent>( + std::unique_ptr<ui::Event> event = std::make_unique<ui::KeyEvent>( ui::ET_KEY_RELEASED, ui::VKEY_UNKNOWN, ui::EF_NONE); item_delegate->ItemSelected(std::move(event), display_id, LAUNCH_FROM_UNKNOWN, base::Bind(&NoopCallback)); @@ -326,7 +327,7 @@ } else if (!auto_hide_event_handler_ && Shell::GetAshConfig() != Config::MASH) { auto_hide_event_handler_ = - base::MakeUnique<AutoHideEventHandler>(shelf_layout_manager()); + std::make_unique<AutoHideEventHandler>(shelf_layout_manager()); } }
diff --git a/ash/shelf/shelf_application_menu_model_unittest.cc b/ash/shelf/shelf_application_menu_model_unittest.cc index 09dbd3c..498bcfde 100644 --- a/ash/shelf/shelf_application_menu_model_unittest.cc +++ b/ash/shelf/shelf_application_menu_model_unittest.cc
@@ -4,10 +4,10 @@ #include "ash/shelf/shelf_application_menu_model.h" +#include <memory> #include <utility> #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/strings/utf_string_conversions.h" #include "base/test/histogram_tester.h" #include "testing/gtest/include/gtest/gtest.h"
diff --git a/ash/shelf/shelf_button.cc b/ash/shelf/shelf_button.cc index bf24c1a1..6c9b2994 100644 --- a/ash/shelf/shelf_button.cc +++ b/ash/shelf/shelf_button.cc
@@ -5,6 +5,7 @@ #include "ash/shelf/shelf_button.h" #include <algorithm> +#include <memory> #include "ash/ash_constants.h" #include "ash/shelf/ink_drop_button_listener.h" @@ -12,7 +13,6 @@ #include "ash/shelf/shelf_constants.h" #include "ash/shelf/shelf_view.h" #include "ash/system/tray/tray_popup_utils.h" -#include "base/memory/ptr_util.h" #include "base/time/time.h" #include "skia/ext/image_operations.h" #include "ui/accessibility/ax_node_data.h" @@ -507,7 +507,7 @@ } std::unique_ptr<views::InkDropRipple> ShelfButton::CreateInkDropRipple() const { - return base::MakeUnique<views::SquareInkDropRipple>( + return std::make_unique<views::SquareInkDropRipple>( gfx::Size(kInkDropLargeSize, kInkDropLargeSize), kInkDropLargeCornerRadius, gfx::Size(kInkDropSmallSize, kInkDropSmallSize),
diff --git a/ash/shelf/shelf_context_menu_model.cc b/ash/shelf/shelf_context_menu_model.cc index ec3379c..a8075801 100644 --- a/ash/shelf/shelf_context_menu_model.cc +++ b/ash/shelf/shelf_context_menu_model.cc
@@ -4,6 +4,7 @@ #include "ash/shelf/shelf_context_menu_model.h" +#include <memory> #include <string> #include "ash/public/cpp/ash_pref_names.h" @@ -192,7 +193,7 @@ case ui::MenuModel::TYPE_SUBMENU: if (item->submenu.has_value()) { std::unique_ptr<ui::MenuModel> submenu = - base::MakeUnique<ShelfContextSubMenuModel>( + std::make_unique<ShelfContextSubMenuModel>( delegate, item->submenu.value(), submenus); model->AddSubMenu(item->command_id, item->label, submenu.get()); submenus->push_back(std::move(submenu));
diff --git a/ash/shelf/shelf_controller.cc b/ash/shelf/shelf_controller.cc index 61e30c40..5dcc0b32 100644 --- a/ash/shelf/shelf_controller.cc +++ b/ash/shelf/shelf_controller.cc
@@ -4,6 +4,8 @@ #include "ash/shelf/shelf_controller.h" +#include <memory> + #include "ash/public/cpp/ash_pref_names.h" #include "ash/public/cpp/ash_switches.h" #include "ash/public/cpp/config.h" @@ -98,7 +100,7 @@ // Set the delegate and title string for the app list item. model_.SetShelfItemDelegate(ShelfID(kAppListId), - base::MakeUnique<AppListShelfItemDelegate>()); + std::make_unique<AppListShelfItemDelegate>()); DCHECK_EQ(0, model_.ItemIndexByID(ShelfID(kAppListId))); ShelfItem item = model_.items()[0]; item.title = l10n_util::GetStringUTF16(IDS_ASH_SHELF_APP_LIST_LAUNCHER_TITLE); @@ -229,7 +231,7 @@ base::AutoReset<bool> reset(&applying_remote_shelf_model_changes_, true); if (delegate.is_bound()) model_.SetShelfItemDelegate( - id, base::MakeUnique<RemoteShelfItemDelegate>(id, std::move(delegate))); + id, std::make_unique<RemoteShelfItemDelegate>(id, std::move(delegate))); else model_.SetShelfItemDelegate(id, nullptr); } @@ -289,7 +291,7 @@ void ShelfController::OnActiveUserPrefServiceChanged( PrefService* pref_service) { SetShelfBehaviorsFromPrefs(); - pref_change_registrar_ = base::MakeUnique<PrefChangeRegistrar>(); + pref_change_registrar_ = std::make_unique<PrefChangeRegistrar>(); pref_change_registrar_->Init(pref_service); pref_change_registrar_->Add(prefs::kShelfAlignmentLocal, base::Bind(&SetShelfAlignmentFromPrefs));
diff --git a/ash/shelf/shelf_layout_manager_unittest.cc b/ash/shelf/shelf_layout_manager_unittest.cc index 7d179d9..bbebcaa 100644 --- a/ash/shelf/shelf_layout_manager_unittest.cc +++ b/ash/shelf/shelf_layout_manager_unittest.cc
@@ -4,6 +4,8 @@ #include "ash/shelf/shelf_layout_manager.h" +#include <memory> + #include "ash/accelerators/accelerator_controller.h" #include "ash/accelerators/accelerator_table.h" #include "ash/app_list/test_app_list_presenter_impl.h" @@ -29,7 +31,6 @@ #include "ash/wm/window_state.h" #include "ash/wm/window_util.h" #include "base/command_line.h" -#include "base/memory/ptr_util.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/test/scoped_feature_list.h"
diff --git a/ash/shelf/shelf_tooltip_manager_unittest.cc b/ash/shelf/shelf_tooltip_manager_unittest.cc index 9923b75..d383806d 100644 --- a/ash/shelf/shelf_tooltip_manager_unittest.cc +++ b/ash/shelf/shelf_tooltip_manager_unittest.cc
@@ -4,6 +4,8 @@ #include "ash/shelf/shelf_tooltip_manager.h" +#include <memory> + #include "ash/public/cpp/config.h" #include "ash/public/cpp/shelf_model.h" #include "ash/shelf/app_list_button.h" @@ -12,7 +14,6 @@ #include "ash/shelf/shelf_view_test_api.h" #include "ash/shell.h" #include "ash/test/ash_test_base.h" -#include "base/memory/ptr_util.h" #include "ui/events/event_constants.h" #include "ui/events/test/event_generator.h" #include "ui/views/bubble/bubble_dialog_delegate.h" @@ -36,7 +37,7 @@ views::Widget* GetTooltip() { return tooltip_manager_->bubble_->GetWidget(); } std::unique_ptr<views::Widget> CreateTestWidget() { - std::unique_ptr<views::Widget> widget = base::MakeUnique<views::Widget>(); + std::unique_ptr<views::Widget> widget = std::make_unique<views::Widget>(); views::Widget::InitParams params; params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; params.context = CurrentContext();
diff --git a/ash/shelf/shelf_view.cc b/ash/shelf/shelf_view.cc index cd026c3..9cf5612f 100644 --- a/ash/shelf/shelf_view.cc +++ b/ash/shelf/shelf_view.cc
@@ -31,7 +31,6 @@ #include "ash/wm/root_window_finder.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "base/auto_reset.h" -#include "base/memory/ptr_util.h" #include "base/metrics/histogram_macros.h" #include "ui/accessibility/ax_node_data.h" #include "ui/app_list/app_list_features.h" @@ -509,7 +508,7 @@ drag_replaced_view_ = replaced_view; aura::Window* root_window = drag_replaced_view_->GetWidget()->GetNativeWindow()->GetRootWindow(); - drag_image_ = base::MakeUnique<DragImageView>( + drag_image_ = std::make_unique<DragImageView>( root_window, ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE); drag_image_->SetImage(icon); gfx::Size size = drag_image_->GetPreferredSize(); @@ -531,7 +530,7 @@ drag_replaced_view_ = replaced_view; aura::Window* root_window = drag_replaced_view_->GetWidget()->GetNativeWindow()->GetRootWindow(); - drag_image_ = base::MakeUnique<DragImageView>( + drag_image_ = std::make_unique<DragImageView>( root_window, ui::DragDropTypes::DRAG_EVENT_SOURCE_MOUSE); drag_image_->SetImage(icon); gfx::Size size = drag_image_->GetPreferredSize(); @@ -1731,7 +1730,7 @@ // Show the app menu with 2 or more items, if no window was created. ink_drop->AnimateToState(views::InkDropState::ACTIVATED); context_menu_id_ = item.id; - ShowMenu(base::MakeUnique<ShelfApplicationMenuModel>( + ShowMenu(std::make_unique<ShelfApplicationMenuModel>( item.title, std::move(*menu_items), model_->GetShelfItemDelegate(item.id)), sender, gfx::Point(), false, @@ -1751,7 +1750,7 @@ std::vector<mojom::MenuItemPtr> menu_items) { context_menu_id_ = shelf_id; const int64_t display_id = GetDisplayIdForView(this); - ShowMenu(base::MakeUnique<ShelfContextMenuModel>( + ShowMenu(std::make_unique<ShelfContextMenuModel>( std::move(menu_items), model_->GetShelfItemDelegate(shelf_id), display_id), source, point, true /* context_menu */, source_type, @@ -1792,7 +1791,7 @@ const ShelfItem* item = ShelfItemForView(source); if (!item || !model_->GetShelfItemDelegate(item->id)) { context_menu_id_ = ShelfID(); - ShowMenu(base::MakeUnique<ShelfContextMenuModel>( + ShowMenu(std::make_unique<ShelfContextMenuModel>( std::vector<mojom::MenuItemPtr>(), nullptr, display_id), source, context_menu_point, true, source_type, nullptr); return;
diff --git a/ash/shelf/shelf_view_unittest.cc b/ash/shelf/shelf_view_unittest.cc index 503e3b3..d3cca4a 100644 --- a/ash/shelf/shelf_view_unittest.cc +++ b/ash/shelf/shelf_view_unittest.cc
@@ -293,7 +293,7 @@ model_->Add(item); // Set a delegate; some tests require one to select the item. model_->SetShelfItemDelegate(item.id, - base::MakeUnique<ShelfItemSelectionTracker>()); + std::make_unique<ShelfItemSelectionTracker>()); if (wait_for_animations) test_api_->RunMessageLoopUntilAnimationsDone(); return item.id; @@ -1148,9 +1148,8 @@ TEST_F(ShelfViewTest, ClickingTwiceActivatesOnce) { // Watch for selection of the browser shortcut. ShelfItemSelectionTracker* selection_tracker = new ShelfItemSelectionTracker; - model_->SetShelfItemDelegate( - model_->items()[1].id, - base::WrapUnique<ShelfItemSelectionTracker>(selection_tracker)); + model_->SetShelfItemDelegate(model_->items()[1].id, + base::WrapUnique(selection_tracker)); // A single click selects the item, but a double-click does not. EXPECT_EQ(0u, selection_tracker->item_selected_count()); @@ -2245,7 +2244,7 @@ app_list_button_ = shelf_view_->GetAppListButton(); auto app_list_button_ink_drop = - base::MakeUnique<InkDropSpy>(base::MakeUnique<views::InkDropImpl>( + std::make_unique<InkDropSpy>(std::make_unique<views::InkDropImpl>( app_list_button_, app_list_button_->size())); app_list_button_ink_drop_ = app_list_button_ink_drop.get(); views::test::InkDropHostViewTestApi(app_list_button_) @@ -2256,7 +2255,7 @@ browser_button_ = test_api_->GetButton(1); auto browser_button_ink_drop = - base::MakeUnique<InkDropSpy>(base::MakeUnique<views::InkDropImpl>( + std::make_unique<InkDropSpy>(std::make_unique<views::InkDropImpl>( browser_button_, browser_button_->size())); browser_button_ink_drop_ = browser_button_ink_drop.get(); views::test::InkDropHostViewTestApi(browser_button_) @@ -2601,7 +2600,7 @@ // Set a delegate for the shelf item that returns an app list menu. model_->SetShelfItemDelegate(model_->items()[1].id, - base::MakeUnique<ListMenuShelfItemDelegate>()); + std::make_unique<ListMenuShelfItemDelegate>()); views::Button* button = browser_button_; gfx::Point mouse_location = button->GetLocalBounds().CenterPoint(); @@ -2815,7 +2814,7 @@ overflow_button_ = test_api_->overflow_button(); auto overflow_button_ink_drop = - base::MakeUnique<InkDropSpy>(base::MakeUnique<views::InkDropImpl>( + std::make_unique<InkDropSpy>(std::make_unique<views::InkDropImpl>( overflow_button_, overflow_button_->size())); overflow_button_ink_drop_ = overflow_button_ink_drop.get(); views::test::InkDropHostViewTestApi(overflow_button_) @@ -3088,7 +3087,7 @@ OverflowButtonInkDropTest::SetUp(); overflow_button_test_api_ = - base::MakeUnique<OverflowButtonTestApi>(overflow_button_); + std::make_unique<OverflowButtonTestApi>(overflow_button_); } protected:
diff --git a/ash/shelf/shelf_widget.cc b/ash/shelf/shelf_widget.cc index cbfec50..8c94d16 100644 --- a/ash/shelf/shelf_widget.cc +++ b/ash/shelf/shelf_widget.cc
@@ -20,7 +20,6 @@ #include "ash/system/status_area_layout_manager.h" #include "ash/system/status_area_widget.h" #include "base/command_line.h" -#include "base/memory/ptr_util.h" #include "chromeos/chromeos_switches.h" #include "ui/compositor/layer.h" #include "ui/compositor/scoped_layer_animation_settings.h"
diff --git a/ash/shelf/shelf_window_watcher.cc b/ash/shelf/shelf_window_watcher.cc index 0830065b..bd0c746 100644 --- a/ash/shelf/shelf_window_watcher.cc +++ b/ash/shelf/shelf_window_watcher.cc
@@ -184,7 +184,7 @@ model_->SetShelfItemDelegate( item.id, - base::MakeUnique<ShelfWindowWatcherItemDelegate>(item.id, window)); + std::make_unique<ShelfWindowWatcherItemDelegate>(item.id, window)); // Panels are inserted on the left so as not to push all existing panels over. model_->AddAt(item.type == TYPE_APP_PANEL ? 0 : model_->item_count(), item);
diff --git a/ash/shelf/shelf_window_watcher_unittest.cc b/ash/shelf/shelf_window_watcher_unittest.cc index 3b87d7784..8f663acd 100644 --- a/ash/shelf/shelf_window_watcher_unittest.cc +++ b/ash/shelf/shelf_window_watcher_unittest.cc
@@ -4,6 +4,8 @@ #include "ash/shelf/shelf_window_watcher.h" +#include <memory> + #include "ash/public/cpp/config.h" #include "ash/public/cpp/shelf_item.h" #include "ash/public/cpp/shelf_model.h" @@ -114,7 +116,7 @@ aura::client::WINDOW_TYPE_TOOLTIP}; for (aura::client::WindowType type : no_item_types) { std::unique_ptr<aura::Window> window = - base::MakeUnique<aura::Window>(nullptr, type); + std::make_unique<aura::Window>(nullptr, type); window->Init(ui::LAYER_NOT_DRAWN); Shell::GetPrimaryRootWindow() ->GetChildById(kShellWindowId_DefaultContainer) @@ -359,7 +361,7 @@ TEST_F(ShelfWindowWatcherTest, DontCreateShelfEntriesForChildWindows) { EXPECT_EQ(1, model_->item_count()); std::unique_ptr<aura::Window> window = - base::MakeUnique<aura::Window>(nullptr, aura::client::WINDOW_TYPE_NORMAL); + std::make_unique<aura::Window>(nullptr, aura::client::WINDOW_TYPE_NORMAL); window->Init(ui::LAYER_NOT_DRAWN); window->SetProperty(kShelfIDKey, new std::string(ShelfID("a").Serialize())); window->SetProperty(kShelfItemTypeKey, static_cast<int32_t>(TYPE_DIALOG)); @@ -370,7 +372,7 @@ EXPECT_EQ(2, model_->item_count()); std::unique_ptr<aura::Window> child = - base::MakeUnique<aura::Window>(nullptr, aura::client::WINDOW_TYPE_NORMAL); + std::make_unique<aura::Window>(nullptr, aura::client::WINDOW_TYPE_NORMAL); child->Init(ui::LAYER_NOT_DRAWN); child->SetProperty(kShelfIDKey, new std::string(ShelfID("b").Serialize())); child->SetProperty(kShelfItemTypeKey, static_cast<int32_t>(TYPE_DIALOG)); @@ -388,7 +390,7 @@ TEST_F(ShelfWindowWatcherTest, CreateShelfEntriesForTransientWindows) { EXPECT_EQ(1, model_->item_count()); std::unique_ptr<aura::Window> window = - base::MakeUnique<aura::Window>(nullptr, aura::client::WINDOW_TYPE_NORMAL); + std::make_unique<aura::Window>(nullptr, aura::client::WINDOW_TYPE_NORMAL); window->Init(ui::LAYER_NOT_DRAWN); window->SetProperty(kShelfIDKey, new std::string(ShelfID("a").Serialize())); window->SetProperty(kShelfItemTypeKey, static_cast<int32_t>(TYPE_DIALOG)); @@ -399,7 +401,7 @@ EXPECT_EQ(2, model_->item_count()); std::unique_ptr<aura::Window> transient = - base::MakeUnique<aura::Window>(nullptr, aura::client::WINDOW_TYPE_NORMAL); + std::make_unique<aura::Window>(nullptr, aura::client::WINDOW_TYPE_NORMAL); transient->Init(ui::LAYER_NOT_DRAWN); transient->SetProperty(kShelfIDKey, new std::string(ShelfID("b").Serialize()));
diff --git a/ash/shelf/voice_interaction_overlay.cc b/ash/shelf/voice_interaction_overlay.cc index 67109ae..8661b9a 100644 --- a/ash/shelf/voice_interaction_overlay.cc +++ b/ash/shelf/voice_interaction_overlay.cc
@@ -21,7 +21,6 @@ #include "ash/system/tray/tray_popup_utils.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "base/command_line.h" -#include "base/memory/ptr_util.h" #include "base/metrics/user_metrics.h" #include "base/metrics/user_metrics_action.h" #include "base/time/time.h"
diff --git a/ash/shell.cc b/ash/shell.cc index affb236..c45789dc 100644 --- a/ash/shell.cc +++ b/ash/shell.cc
@@ -5,6 +5,7 @@ #include "ash/shell.h" #include <algorithm> +#include <memory> #include <string> #include <utility> @@ -597,32 +598,32 @@ Shell::Shell(std::unique_ptr<ShellDelegate> shell_delegate, std::unique_ptr<ShellPort> shell_port) : shell_port_(std::move(shell_port)), - ash_display_controller_(base::MakeUnique<AshDisplayController>()), + ash_display_controller_(std::make_unique<AshDisplayController>()), brightness_control_delegate_( - base::MakeUnique<system::BrightnessControllerChromeos>()), - cast_config_(base::MakeUnique<CastConfigController>()), - focus_cycler_(base::MakeUnique<FocusCycler>()), - ime_controller_(base::MakeUnique<ImeController>()), - immersive_context_(base::MakeUnique<ImmersiveContextAsh>()), + std::make_unique<system::BrightnessControllerChromeos>()), + cast_config_(std::make_unique<CastConfigController>()), + focus_cycler_(std::make_unique<FocusCycler>()), + ime_controller_(std::make_unique<ImeController>()), + immersive_context_(std::make_unique<ImmersiveContextAsh>()), keyboard_brightness_control_delegate_( - base::MakeUnique<KeyboardBrightnessController>()), + std::make_unique<KeyboardBrightnessController>()), locale_notification_controller_( - base::MakeUnique<LocaleNotificationController>()), - lock_screen_controller_(base::MakeUnique<LockScreenController>()), - media_controller_(base::MakeUnique<MediaController>()), - new_window_controller_(base::MakeUnique<NewWindowController>()), - session_controller_(base::MakeUnique<SessionController>( + std::make_unique<LocaleNotificationController>()), + lock_screen_controller_(std::make_unique<LockScreenController>()), + media_controller_(std::make_unique<MediaController>()), + new_window_controller_(std::make_unique<NewWindowController>()), + session_controller_(std::make_unique<SessionController>( shell_delegate->GetShellConnector())), shell_delegate_(std::move(shell_delegate)), - shutdown_controller_(base::MakeUnique<ShutdownController>()), - system_tray_controller_(base::MakeUnique<SystemTrayController>()), - system_tray_notifier_(base::MakeUnique<SystemTrayNotifier>()), - tray_action_(base::MakeUnique<TrayAction>()), - vpn_list_(base::MakeUnique<VpnList>()), - window_cycle_controller_(base::MakeUnique<WindowCycleController>()), - window_selector_controller_(base::MakeUnique<WindowSelectorController>()), - app_list_(base::MakeUnique<app_list::AppList>()), - tray_bluetooth_helper_(base::MakeUnique<TrayBluetoothHelper>()), + shutdown_controller_(std::make_unique<ShutdownController>()), + system_tray_controller_(std::make_unique<SystemTrayController>()), + system_tray_notifier_(std::make_unique<SystemTrayNotifier>()), + tray_action_(std::make_unique<TrayAction>()), + vpn_list_(std::make_unique<VpnList>()), + window_cycle_controller_(std::make_unique<WindowCycleController>()), + window_selector_controller_(std::make_unique<WindowSelectorController>()), + app_list_(std::make_unique<app_list::AppList>()), + tray_bluetooth_helper_(std::make_unique<TrayBluetoothHelper>()), display_configurator_(new display::DisplayConfigurator()), native_cursor_manager_(nullptr), simulate_modal_window_open_for_testing_(false), @@ -634,8 +635,8 @@ gpu_support_.reset(shell_delegate_->CreateGPUSupport()); display_manager_.reset(ScreenAsh::CreateDisplayManager()); - window_tree_host_manager_ = base::MakeUnique<WindowTreeHostManager>(); - user_metrics_recorder_ = base::MakeUnique<UserMetricsRecorder>(); + window_tree_host_manager_ = std::make_unique<WindowTreeHostManager>(); + user_metrics_recorder_ = std::make_unique<UserMetricsRecorder>(); PowerStatus::Initialize(); @@ -843,11 +844,11 @@ const Config config = shell_port_->GetAshConfig(); if (NightLightController::IsFeatureEnabled()) - night_light_controller_ = base::MakeUnique<NightLightController>(); + night_light_controller_ = std::make_unique<NightLightController>(); touch_devices_controller_ = std::make_unique<TouchDevicesController>(); - bluetooth_power_controller_ = base::MakeUnique<BluetoothPowerController>(); + bluetooth_power_controller_ = std::make_unique<BluetoothPowerController>(); wallpaper_delegate_ = shell_delegate_->CreateWallpaperDelegate(); @@ -868,32 +869,32 @@ // Some delegates access ShellPort during their construction. Create them here // instead of the ShellPort constructor. accessibility_delegate_.reset(shell_delegate_->CreateAccessibilityDelegate()); - accessibility_controller_ = base::MakeUnique<AccessibilityController>( + accessibility_controller_ = std::make_unique<AccessibilityController>( shell_delegate_->GetShellConnector()); palette_delegate_ = shell_delegate_->CreatePaletteDelegate(); - toast_manager_ = base::MakeUnique<ToastManager>(); + toast_manager_ = std::make_unique<ToastManager>(); // Install the custom factory early on so that views::FocusManagers for Tray, // Shelf, and WallPaper could be created by the factory. views::FocusManagerFactory::Install(new AshFocusManagerFactory); - wallpaper_controller_ = base::MakeUnique<WallpaperController>(); + wallpaper_controller_ = std::make_unique<WallpaperController>(); - app_list_delegate_impl_ = base::MakeUnique<AppListDelegateImpl>(); + app_list_delegate_impl_ = std::make_unique<AppListDelegateImpl>(); // TODO(sky): move creation to ShellPort. if (config != Config::MASH) - immersive_handler_factory_ = base::MakeUnique<ImmersiveHandlerFactoryAsh>(); + immersive_handler_factory_ = std::make_unique<ImmersiveHandlerFactoryAsh>(); - window_positioner_ = base::MakeUnique<WindowPositioner>(); + window_positioner_ = std::make_unique<WindowPositioner>(); if (config == Config::CLASSIC) { native_cursor_manager_ = new NativeCursorManagerAshClassic; - cursor_manager_ = base::MakeUnique<CursorManager>( + cursor_manager_ = std::make_unique<CursorManager>( base::WrapUnique(native_cursor_manager_)); } else if (config == Config::MUS) { native_cursor_manager_ = new NativeCursorManagerAshMus; - cursor_manager_ = base::MakeUnique<CursorManager>( + cursor_manager_ = std::make_unique<CursorManager>( base::WrapUnique(native_cursor_manager_)); } @@ -905,7 +906,7 @@ display_configurator_->set_configure_display(true); } display_configuration_controller_ = - base::MakeUnique<DisplayConfigurationController>( + std::make_unique<DisplayConfigurationController>( display_manager_.get(), window_tree_host_manager_.get()); display_configurator_->Init(shell_port_->CreateNativeDisplayDelegate(), !gpu_support_->IsPanelFittingDisabled()); @@ -920,11 +921,11 @@ if (!display_initialized && (config != Config::CLASSIC || chromeos::IsRunningAsSystemCompositor())) { - display_change_observer_ = base::MakeUnique<display::DisplayChangeObserver>( + display_change_observer_ = std::make_unique<display::DisplayChangeObserver>( display_configurator_.get(), display_manager_.get()); shutdown_observer_ = - base::MakeUnique<ShutdownObserver>(display_configurator_.get()); + std::make_unique<ShutdownObserver>(display_configurator_.get()); // Register |display_change_observer_| first so that the rest of // observer gets invoked after the root windows are configured. @@ -937,7 +938,7 @@ display_initialized = true; } display_color_manager_ = - base::MakeUnique<DisplayColorManager>(display_configurator_.get()); + std::make_unique<DisplayColorManager>(display_configurator_.get()); if (!display_initialized) display_manager_->InitDefaultDisplay(); @@ -960,7 +961,7 @@ // FocusController takes ownership of AshFocusRules. focus_controller_ = - base::MakeUnique<::wm::FocusController>(new wm::AshFocusRules()); + std::make_unique<::wm::FocusController>(new wm::AshFocusRules()); focus_controller_->AddObserver(this); if (config != Config::CLASSIC) { window_tree_client_->focus_synchronizer()->SetSingletonFocusClient( @@ -976,7 +977,7 @@ root_window_for_new_windows_ = GetPrimaryRootWindow(); resolution_notification_controller_ = - base::MakeUnique<ResolutionNotificationController>(); + std::make_unique<ResolutionNotificationController>(); if (cursor_manager_) { cursor_manager_->SetDisplay( @@ -984,8 +985,8 @@ } accelerator_controller_ = shell_port_->CreateAcceleratorController(); - tablet_mode_controller_ = base::MakeUnique<TabletModeController>(); - shelf_controller_ = base::MakeUnique<ShelfController>(); + tablet_mode_controller_ = std::make_unique<TabletModeController>(); + shelf_controller_ = std::make_unique<ShelfController>(); magnifier_key_scroll_handler_ = MagnifierKeyScroller::CreateHandler(); AddPreTargetHandler(magnifier_key_scroll_handler_.get()); @@ -1010,7 +1011,7 @@ AddPreTargetHandler(event_transformation_handler_.get()); toplevel_window_event_handler_ = - base::MakeUnique<ToplevelWindowEventHandler>(); + std::make_unique<ToplevelWindowEventHandler>(); if (config != Config::MASH) { system_gesture_filter_.reset(new SystemGestureEventFilter); @@ -1018,10 +1019,10 @@ } sticky_keys_controller_.reset(new StickyKeysController); - screen_pinning_controller_ = base::MakeUnique<ScreenPinningController>(); + screen_pinning_controller_ = std::make_unique<ScreenPinningController>(); lock_state_controller_ = - base::MakeUnique<LockStateController>(shutdown_controller_.get()); + std::make_unique<LockStateController>(shutdown_controller_.get()); power_button_controller_ = std::make_unique<PowerButtonController>(); // Pass the initial display state to PowerButtonController. power_button_controller_->OnDisplayModeChanged( @@ -1034,20 +1035,20 @@ ui::mojom::UserActivityMonitorPtr user_activity_monitor; shell_delegate_->GetShellConnector()->BindInterface(ui::mojom::kServiceName, &user_activity_monitor); - user_activity_forwarder_ = base::MakeUnique<aura::UserActivityForwarder>( + user_activity_forwarder_ = std::make_unique<aura::UserActivityForwarder>( std::move(user_activity_monitor), user_activity_detector_.get()); } // In mash drag and drop is handled by mus. if (config != Config::MASH) - drag_drop_controller_ = base::MakeUnique<DragDropController>(); + drag_drop_controller_ = std::make_unique<DragDropController>(); // |screenshot_controller_| needs to be created (and prepended as a // pre-target handler) at this point, because |mouse_cursor_filter_| needs to // process mouse events prior to screenshot session. // See http://crbug.com/459214 screenshot_controller_.reset(new ScreenshotController()); - mouse_cursor_filter_ = base::MakeUnique<MouseCursorEventFilter>(); + mouse_cursor_filter_ = std::make_unique<MouseCursorEventFilter>(); PrependPreTargetHandler(mouse_cursor_filter_.get()); // Create Controllers that may need root window. @@ -1060,7 +1061,7 @@ highlighter_controller_.reset(new HighlighterController()); magnification_controller_.reset(MagnificationController::CreateInstance()); - mru_window_tracker_ = base::MakeUnique<MruWindowTracker>(); + mru_window_tracker_ = std::make_unique<MruWindowTracker>(); autoclick_controller_.reset(AutoclickController::CreateInstance()); @@ -1084,7 +1085,7 @@ shadow_controller_.reset(new ::wm::ShadowController(focus_controller_.get())); logout_confirmation_controller_ = - base::MakeUnique<LogoutConfirmationController>(); + std::make_unique<LogoutConfirmationController>(); // May trigger initialization of the Bluetooth adapter. tray_bluetooth_helper_->Initialize(); @@ -1093,7 +1094,7 @@ // WindowTreeHostManager::InitDisplays() // since AshTouchTransformController listens on // WindowTreeHostManager::Observer::OnDisplaysInitialized(). - touch_transformer_controller_ = base::MakeUnique<AshTouchTransformController>( + touch_transformer_controller_ = std::make_unique<AshTouchTransformController>( display_configurator_.get(), display_manager_.get(), shell_port_->CreateTouchTransformDelegate()); @@ -1120,7 +1121,7 @@ cursor_manager_->SetCursor(ui::CursorType::kPointer); } - peripheral_battery_notifier_ = base::MakeUnique<PeripheralBatteryNotifier>(); + peripheral_battery_notifier_ = std::make_unique<PeripheralBatteryNotifier>(); power_event_observer_.reset(new PowerEventObserver()); user_activity_notifier_.reset( new ui::UserActivityPowerManagerNotifier(user_activity_detector_.get())); @@ -1128,7 +1129,7 @@ new VideoActivityNotifier(video_detector_.get())); bluetooth_notification_controller_.reset(new BluetoothNotificationController); screen_orientation_controller_ = - base::MakeUnique<ScreenOrientationController>(); + std::make_unique<ScreenOrientationController>(); screen_layout_observer_.reset(new ScreenLayoutObserver()); sms_observer_.reset(new SmsObserver()); @@ -1139,7 +1140,7 @@ // is started. display_manager_->CreateMirrorWindowAsyncIfAny(); - message_center_controller_ = base::MakeUnique<MessageCenterController>(); + message_center_controller_ = std::make_unique<MessageCenterController>(); for (auto& observer : shell_observers_) observer.OnShellInitialized(); @@ -1268,7 +1269,7 @@ DCHECK_GT(session_controller()->NumberOfLoggedInUsers(), 0); if (!shelf_window_watcher_) - shelf_window_watcher_ = base::MakeUnique<ShelfWindowWatcher>(shelf_model()); + shelf_window_watcher_ = std::make_unique<ShelfWindowWatcher>(shelf_model()); for (RootWindowController* root : GetAllRootWindowControllers()) root->InitializeShelf();
diff --git a/ash/shell/app_list.cc b/ash/shell/app_list.cc index ff97ffe..8f1d2188e 100644 --- a/ash/shell/app_list.cc +++ b/ash/shell/app_list.cc
@@ -16,7 +16,6 @@ #include "base/files/file_path.h" #include "base/i18n/case_conversion.h" #include "base/i18n/string_search.h" -#include "base/memory/ptr_util.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" @@ -261,7 +260,7 @@ if (base::i18n::StringSearchIgnoringCaseAndAccents(query, title, NULL, NULL)) { model_->results()->Add( - base::MakeUnique<ExampleSearchResult>(type, query)); + std::make_unique<ExampleSearchResult>(type, query)); } } }
diff --git a/ash/shell/content/client/shell_browser_main_parts.cc b/ash/shell/content/client/shell_browser_main_parts.cc index 75fedb5d..4d857bc 100644 --- a/ash/shell/content/client/shell_browser_main_parts.cc +++ b/ash/shell/content/client/shell_browser_main_parts.cc
@@ -4,6 +4,8 @@ #include "ash/shell/content/client/shell_browser_main_parts.h" +#include <memory> + #include "ash/content/shell_content_state.h" #include "ash/login_status.h" #include "ash/shell.h" @@ -18,7 +20,6 @@ #include "base/bind.h" #include "base/command_line.h" #include "base/i18n/icu_util.h" -#include "base/memory/ptr_util.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/strings/string_number_conversions.h" @@ -95,11 +96,11 @@ // Initialize session controller client and create fake user sessions. The // fake user sessions makes ash into the logged in state. example_session_controller_client_ = - base::MakeUnique<ExampleSessionControllerClient>( + std::make_unique<ExampleSessionControllerClient>( Shell::Get()->session_controller()); example_session_controller_client_->Initialize(); - window_watcher_ = base::MakeUnique<WindowWatcher>(); + window_watcher_ = std::make_unique<WindowWatcher>(); ash::shell::InitWindowTypeLauncher(base::Bind( &views::examples::ShowExamplesWindowWithContent, @@ -107,7 +108,7 @@ ShellContentState::GetInstance()->GetActiveBrowserContext(), nullptr)); // Initialize the example app list presenter. - example_app_list_presenter_ = base::MakeUnique<ExampleAppListPresenter>(); + example_app_list_presenter_ = std::make_unique<ExampleAppListPresenter>(); Shell::Get()->app_list()->SetAppListPresenter( example_app_list_presenter_->CreateInterfacePtrAndBind());
diff --git a/ash/shell/example_app_list_presenter.cc b/ash/shell/example_app_list_presenter.cc index 0627d05..d48e655a 100644 --- a/ash/shell/example_app_list_presenter.cc +++ b/ash/shell/example_app_list_presenter.cc
@@ -39,8 +39,8 @@ ExampleAppListPresenter::ExampleAppListPresenter() : binding_(this), app_list_presenter_impl_( - base::MakeUnique<AppListPresenterDelegateFactory>( - base::MakeUnique<ExampleAppListViewDelegateFactory>())) { + std::make_unique<AppListPresenterDelegateFactory>( + std::make_unique<ExampleAppListViewDelegateFactory>())) { // Note: This example |app_list_presenter_impl_| does not report visibility // changes to the app_list::mojom::AppList implementation owned by ShellPort. }
diff --git a/ash/shell/shell_delegate_impl.cc b/ash/shell/shell_delegate_impl.cc index def2b4b..55b0f3ad 100644 --- a/ash/shell/shell_delegate_impl.cc +++ b/ash/shell/shell_delegate_impl.cc
@@ -4,6 +4,8 @@ #include "ash/shell/shell_delegate_impl.h" +#include <memory> + #include "ash/accessibility/default_accessibility_delegate.h" #include "ash/default_wallpaper_delegate.h" #include "ash/gpu_support_stub.h" @@ -16,7 +18,6 @@ #include "ash/shell/example_factory.h" #include "ash/shell/toplevel_window.h" #include "ash/wm/window_state.h" -#include "base/memory/ptr_util.h" #include "base/strings/utf_string_conversions.h" #include "components/user_manager/user_info_impl.h" #include "ui/aura/window.h" @@ -80,7 +81,7 @@ void ShellDelegateImpl::PreShutdown() {} std::unique_ptr<keyboard::KeyboardUI> ShellDelegateImpl::CreateKeyboardUI() { - return base::MakeUnique<TestKeyboardUI>(); + return std::make_unique<TestKeyboardUI>(); } void ShellDelegateImpl::OpenUrlFromArc(const GURL& url) {} @@ -91,7 +92,7 @@ std::unique_ptr<WallpaperDelegate> ShellDelegateImpl::CreateWallpaperDelegate() { - return base::MakeUnique<DefaultWallpaperDelegate>(); + return std::make_unique<DefaultWallpaperDelegate>(); } AccessibilityDelegate* ShellDelegateImpl::CreateAccessibilityDelegate() { @@ -99,7 +100,7 @@ } std::unique_ptr<PaletteDelegate> ShellDelegateImpl::CreatePaletteDelegate() { - return base::MakeUnique<PaletteDelegateImpl>(); + return std::make_unique<PaletteDelegateImpl>(); } GPUSupport* ShellDelegateImpl::CreateGPUSupport() {
diff --git a/ash/shell/window_watcher.cc b/ash/shell/window_watcher.cc index a4ed5b0c..539d6fd3 100644 --- a/ash/shell/window_watcher.cc +++ b/ash/shell/window_watcher.cc
@@ -4,6 +4,7 @@ #include "ash/shell/window_watcher.h" +#include <memory> #include <utility> #include "ash/public/cpp/shelf_item.h" @@ -14,7 +15,6 @@ #include "ash/shell.h" #include "ash/shell/window_watcher_shelf_item_delegate.h" #include "ash/wm/window_util.h" -#include "base/memory/ptr_util.h" #include "base/strings/string_number_conversions.h" #include "third_party/skia/include/core/SkColor.h" #include "ui/aura/window.h" @@ -70,7 +70,7 @@ WindowWatcher::WindowWatcher() { Shell::Get()->AddShellObserver(this); - workspace_window_watcher_ = base::MakeUnique<WorkspaceWindowWatcher>(this); + workspace_window_watcher_ = std::make_unique<WorkspaceWindowWatcher>(this); for (aura::Window* root : Shell::GetAllRootWindows()) workspace_window_watcher_->RootWindowAdded(root); } @@ -109,7 +109,7 @@ model->Add(item); model->SetShelfItemDelegate( - item.id, base::MakeUnique<WindowWatcherShelfItemDelegate>(item.id, this)); + item.id, std::make_unique<WindowWatcherShelfItemDelegate>(item.id, this)); new_window->SetProperty(kShelfIDKey, new std::string(item.id.Serialize())); }
diff --git a/ash/shell_port.cc b/ash/shell_port.cc index a264fa68..77208b1 100644 --- a/ash/shell_port.cc +++ b/ash/shell_port.cc
@@ -17,7 +17,6 @@ #include "ash/wm/system_modal_container_layout_manager.h" #include "base/bind.h" #include "base/logging.h" -#include "base/memory/ptr_util.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/window.h" #include "ui/display/display.h"
diff --git a/ash/shell_port_classic.cc b/ash/shell_port_classic.cc index 414ba56..233a061 100644 --- a/ash/shell_port_classic.cc +++ b/ash/shell_port_classic.cc
@@ -4,6 +4,7 @@ #include "ash/shell_port_classic.h" +#include <memory> #include <utility> #include "ash/accelerators/accelerator_controller.h" @@ -56,7 +57,7 @@ std::unique_ptr<display::TouchTransformSetter> ShellPortClassic::CreateTouchTransformDelegate() { - return base::MakeUnique<display::DefaultTouchTransformSetter>(); + return std::make_unique<display::DefaultTouchTransformSetter>(); } void ShellPortClassic::LockCursor() { @@ -106,22 +107,22 @@ std::unique_ptr<WindowCycleEventFilter> ShellPortClassic::CreateWindowCycleEventFilter() { - return base::MakeUnique<WindowCycleEventFilterClassic>(); + return std::make_unique<WindowCycleEventFilterClassic>(); } std::unique_ptr<wm::TabletModeEventHandler> ShellPortClassic::CreateTabletModeEventHandler() { - return base::WrapUnique(new wm::TabletModeEventHandlerClassic); + return std::make_unique<wm::TabletModeEventHandlerClassic>(); } std::unique_ptr<WorkspaceEventHandler> ShellPortClassic::CreateWorkspaceEventHandler(aura::Window* workspace_window) { - return base::MakeUnique<WorkspaceEventHandlerClassic>(workspace_window); + return std::make_unique<WorkspaceEventHandlerClassic>(workspace_window); } std::unique_ptr<ImmersiveFullscreenController> ShellPortClassic::CreateImmersiveFullscreenController() { - return base::MakeUnique<ImmersiveFullscreenController>(); + return std::make_unique<ImmersiveFullscreenController>(); } std::unique_ptr<KeyboardUI> ShellPortClassic::CreateKeyboardUI() { @@ -155,7 +156,7 @@ } void ShellPortClassic::CreatePointerWatcherAdapter() { - pointer_watcher_adapter_ = base::MakeUnique<PointerWatcherAdapterClassic>(); + pointer_watcher_adapter_ = std::make_unique<PointerWatcherAdapterClassic>(); } std::unique_ptr<AshWindowTreeHost> ShellPortClassic::CreateAshWindowTreeHost( @@ -180,8 +181,8 @@ ShellPortClassic::CreateAcceleratorController() { DCHECK(!accelerator_controller_delegate_); accelerator_controller_delegate_ = - base::MakeUnique<AcceleratorControllerDelegateClassic>(); - return base::MakeUnique<AcceleratorController>( + std::make_unique<AcceleratorControllerDelegateClassic>(); + return std::make_unique<AcceleratorController>( accelerator_controller_delegate_.get(), nullptr); }
diff --git a/ash/shell_unittest.cc b/ash/shell_unittest.cc index 12d10e4..b6b2daa 100644 --- a/ash/shell_unittest.cc +++ b/ash/shell_unittest.cc
@@ -5,6 +5,7 @@ #include "ash/shell.h" #include <algorithm> +#include <memory> #include <vector> #include "ash/display/mouse_cursor_event_filter.h" @@ -565,7 +566,7 @@ // Prefs service wrapper code creates a PrefService. std::unique_ptr<TestingPrefServiceSimple> local_state = - base::MakeUnique<TestingPrefServiceSimple>(); + std::make_unique<TestingPrefServiceSimple>(); Shell::RegisterLocalStatePrefs(local_state->registry()); TestingPrefServiceSimple* local_state_ptr = local_state.get(); ShellTestApi().OnLocalStatePrefServiceInitialized(std::move(local_state));
diff --git a/ash/system/bluetooth/bluetooth_notification_controller.cc b/ash/system/bluetooth/bluetooth_notification_controller.cc index 55cbc9c..93df247 100644 --- a/ash/system/bluetooth/bluetooth_notification_controller.cc +++ b/ash/system/bluetooth/bluetooth_notification_controller.cc
@@ -14,7 +14,6 @@ #include "base/bind.h" #include "base/callback.h" #include "base/logging.h" -#include "base/memory/ptr_util.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "device/bluetooth/bluetooth_adapter_factory.h"
diff --git a/ash/system/bluetooth/bluetooth_power_controller.cc b/ash/system/bluetooth/bluetooth_power_controller.cc index 68acdb1..b55d509 100644 --- a/ash/system/bluetooth/bluetooth_power_controller.cc +++ b/ash/system/bluetooth/bluetooth_power_controller.cc
@@ -4,6 +4,8 @@ #include "ash/system/bluetooth/bluetooth_power_controller.h" +#include <memory> + #include "ash/public/cpp/ash_pref_names.h" #include "ash/session/session_controller.h" #include "ash/shell.h" @@ -68,7 +70,7 @@ DCHECK(active_user_pref_service_); DCHECK(Shell::Get()->session_controller()->IsUserPrimary()); - active_user_pref_change_registrar_ = base::MakeUnique<PrefChangeRegistrar>(); + active_user_pref_change_registrar_ = std::make_unique<PrefChangeRegistrar>(); active_user_pref_change_registrar_->Init(active_user_pref_service_); active_user_pref_change_registrar_->Add( prefs::kUserBluetoothAdapterEnabled, @@ -80,7 +82,7 @@ void BluetoothPowerController::StartWatchingLocalStatePrefsChanges() { DCHECK(local_state_pref_service_); - local_state_pref_change_registrar_ = base::MakeUnique<PrefChangeRegistrar>(); + local_state_pref_change_registrar_ = std::make_unique<PrefChangeRegistrar>(); local_state_pref_change_registrar_->Init(local_state_pref_service_); local_state_pref_change_registrar_->Add( prefs::kSystemBluetoothAdapterEnabled,
diff --git a/ash/system/date/system_info_default_view.cc b/ash/system/date/system_info_default_view.cc index ae78671..65ff333a 100644 --- a/ash/system/date/system_info_default_view.cc +++ b/ash/system/date/system_info_default_view.cc
@@ -4,13 +4,14 @@ #include "ash/system/date/system_info_default_view.h" +#include <memory> + #include "ash/system/date/date_view.h" #include "ash/system/power/power_status.h" #include "ash/system/power/power_status_view.h" #include "ash/system/tray/tray_constants.h" #include "ash/system/tray/tray_popup_utils.h" #include "ash/system/tray/tri_view.h" -#include "base/memory/ptr_util.h" #include "ui/gfx/geometry/insets.h" #include "ui/views/controls/separator.h" #include "ui/views/layout/box_layout.h" @@ -39,7 +40,7 @@ if (PowerStatus::Get()->IsBatteryPresent()) { power_status_view_ = new ash::PowerStatusView(); std::unique_ptr<views::BoxLayout> box_layout = - base::MakeUnique<views::BoxLayout>(views::BoxLayout::kHorizontal); + std::make_unique<views::BoxLayout>(views::BoxLayout::kHorizontal); box_layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); box_layout->set_inside_border_insets(
diff --git a/ash/system/network/network_icon_unittest.cc b/ash/system/network/network_icon_unittest.cc index d64fdc4..d114b3f 100644 --- a/ash/system/network/network_icon_unittest.cc +++ b/ash/system/network/network_icon_unittest.cc
@@ -4,9 +4,10 @@ #include "ash/system/network/network_icon.h" +#include <memory> + #include "ash/strings/grit/ash_strings.h" #include "base/logging.h" -#include "base/memory/ptr_util.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/test/scoped_task_environment.h" @@ -38,23 +39,23 @@ handler_ = chromeos::NetworkHandler::Get()->network_state_handler(); tether_network_ = - base::MakeUnique<chromeos::NetworkState>("tetherNetworkPath"); + std::make_unique<chromeos::NetworkState>("tetherNetworkPath"); tether_network_->set_type(chromeos::kTypeTether); - wifi_network_ = base::MakeUnique<chromeos::NetworkState>("wifiServicePath"); + wifi_network_ = std::make_unique<chromeos::NetworkState>("wifiServicePath"); wifi_network_->set_type(shill::kTypeWifi); cellular_network_ = - base::MakeUnique<chromeos::NetworkState>("cellularServicePath"); + std::make_unique<chromeos::NetworkState>("cellularServicePath"); cellular_network_->set_type(shill::kTypeCellular); wifi_tether_network_ = - base::MakeUnique<chromeos::NetworkState>("wifiTetherServicePath"); + std::make_unique<chromeos::NetworkState>("wifiTetherServicePath"); wifi_tether_network_->set_type(shill::kTypeWifi); wifi_tether_network_.get()->set_tether_guid("tetherNetworkGuid"); ethernet_network_ = - base::MakeUnique<chromeos::NetworkState>("ethernetNetworkPath"); + std::make_unique<chromeos::NetworkState>("ethernetNetworkPath"); ethernet_network_->set_type(shill::kTypeEthernet); }
diff --git a/ash/system/network/network_list.cc b/ash/system/network/network_list.cc index 8f3dead..2752f186 100644 --- a/ash/system/network/network_list.cc +++ b/ash/system/network/network_list.cc
@@ -32,7 +32,6 @@ #include "ash/system/tray/tri_view.h" #include "base/i18n/number_formatting.h" #include "base/logging.h" -#include "base/memory/ptr_util.h" #include "base/memory/weak_ptr.h" #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" @@ -486,7 +485,7 @@ for (const auto* network : networks) { if (!NetworkTypePattern::NonVirtual().MatchesType(network->type())) continue; - network_list_.push_back(base::MakeUnique<NetworkInfo>(network->guid())); + network_list_.push_back(std::make_unique<NetworkInfo>(network->guid())); } }
diff --git a/ash/system/network/sms_observer.cc b/ash/system/network/sms_observer.cc index 3c48142..dc9f5de 100644 --- a/ash/system/network/sms_observer.cc +++ b/ash/system/network/sms_observer.cc
@@ -4,10 +4,11 @@ #include "ash/system/network/sms_observer.h" +#include <memory> + #include "ash/resources/vector_icons/vector_icons.h" #include "ash/system/system_notifier.h" #include "ash/system/tray/tray_constants.h" -#include "base/memory/ptr_util.h" #include "base/strings/utf_string_conversions.h" #include "chromeos/network/network_event_log.h" #include "chromeos/network/network_handler.h"
diff --git a/ash/system/network/sms_observer_unittest.cc b/ash/system/network/sms_observer_unittest.cc index 9cd75c0..e03a081 100644 --- a/ash/system/network/sms_observer_unittest.cc +++ b/ash/system/network/sms_observer_unittest.cc
@@ -4,6 +4,8 @@ #include "ash/system/network/sms_observer.h" +#include <memory> + #include "ash/public/interfaces/vpn_list.mojom.h" #include "ash/shell.h" #include "ash/test/ash_test_base.h" @@ -26,7 +28,7 @@ const char* kDefaultNumber = "000-000-0000", const char* kDefaultTimestamp = "Fri Jun 8 13:26:04 EDT 2016") { std::unique_ptr<base::DictionaryValue> sms = - base::MakeUnique<base::DictionaryValue>(); + std::make_unique<base::DictionaryValue>(); if (kDefaultNumber) sms->SetString("number", kDefaultNumber); if (kDefaultMessage)
diff --git a/ash/system/night_light/night_light_controller.cc b/ash/system/night_light/night_light_controller.cc index 668e3c6..d317dc5 100644 --- a/ash/system/night_light/night_light_controller.cc +++ b/ash/system/night_light/night_light_controller.cc
@@ -5,6 +5,7 @@ #include "ash/system/night_light/night_light_controller.h" #include <cmath> +#include <memory> #include "ash/public/cpp/ash_pref_names.h" #include "ash/public/cpp/ash_switches.h" @@ -121,7 +122,7 @@ } // namespace NightLightController::NightLightController() - : delegate_(base::MakeUnique<NightLightControllerDelegateImpl>()), + : delegate_(std::make_unique<NightLightControllerDelegateImpl>()), binding_(this) { Shell::Get()->session_controller()->AddObserver(this); } @@ -300,7 +301,7 @@ void NightLightController::StartWatchingPrefsChanges() { DCHECK(active_user_pref_service_); - pref_change_registrar_ = base::MakeUnique<PrefChangeRegistrar>(); + pref_change_registrar_ = std::make_unique<PrefChangeRegistrar>(); pref_change_registrar_->Init(active_user_pref_service_); pref_change_registrar_->Add( prefs::kNightLightEnabled,
diff --git a/ash/system/night_light/night_light_controller_unittest.cc b/ash/system/night_light/night_light_controller_unittest.cc index 0df19e0..d6c97185 100644 --- a/ash/system/night_light/night_light_controller_unittest.cc +++ b/ash/system/night_light/night_light_controller_unittest.cc
@@ -21,6 +21,7 @@ #include "base/callback_forward.h" #include "base/command_line.h" #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "components/prefs/pref_service.h" #include "ui/compositor/layer.h"
diff --git a/ash/system/palette/palette_tool.cc b/ash/system/palette/palette_tool.cc index d20e97d..e848d7a 100644 --- a/ash/system/palette/palette_tool.cc +++ b/ash/system/palette/palette_tool.cc
@@ -4,6 +4,8 @@ #include "ash/system/palette/palette_tool.h" +#include <memory> + #include "ash/system/palette/palette_tool_manager.h" #include "ash/system/palette/palette_utils.h" #include "ash/system/palette/tools/capture_region_mode.h" @@ -12,7 +14,6 @@ #include "ash/system/palette/tools/laser_pointer_mode.h" #include "ash/system/palette/tools/magnifier_mode.h" #include "ash/system/palette/tools/metalayer_mode.h" -#include "base/memory/ptr_util.h" #include "chromeos/chromeos_switches.h" #include "ui/gfx/paint_vector_icon.h" @@ -20,13 +21,13 @@ // static void PaletteTool::RegisterToolInstances(PaletteToolManager* tool_manager) { - tool_manager->AddTool(base::MakeUnique<CaptureRegionMode>(tool_manager)); - tool_manager->AddTool(base::MakeUnique<CaptureScreenAction>(tool_manager)); - tool_manager->AddTool(base::MakeUnique<CreateNoteAction>(tool_manager)); + tool_manager->AddTool(std::make_unique<CaptureRegionMode>(tool_manager)); + tool_manager->AddTool(std::make_unique<CaptureScreenAction>(tool_manager)); + tool_manager->AddTool(std::make_unique<CreateNoteAction>(tool_manager)); if (chromeos::switches::IsVoiceInteractionEnabled()) - tool_manager->AddTool(base::MakeUnique<MetalayerMode>(tool_manager)); - tool_manager->AddTool(base::MakeUnique<LaserPointerMode>(tool_manager)); - tool_manager->AddTool(base::MakeUnique<MagnifierMode>(tool_manager)); + tool_manager->AddTool(std::make_unique<MetalayerMode>(tool_manager)); + tool_manager->AddTool(std::make_unique<LaserPointerMode>(tool_manager)); + tool_manager->AddTool(std::make_unique<MagnifierMode>(tool_manager)); } PaletteTool::PaletteTool(Delegate* delegate) : delegate_(delegate) {}
diff --git a/ash/system/palette/palette_tool_manager_unittest.cc b/ash/system/palette/palette_tool_manager_unittest.cc index 5343813..56d8d352 100644 --- a/ash/system/palette/palette_tool_manager_unittest.cc +++ b/ash/system/palette/palette_tool_manager_unittest.cc
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <memory> + #include "ash/system/palette/palette_tool.h" #include "ash/system/palette/palette_tool_manager.h" #include "base/bind.h"
diff --git a/ash/system/palette/palette_tray.cc b/ash/system/palette/palette_tray.cc index 2f332305..82b363d 100644 --- a/ash/system/palette/palette_tray.cc +++ b/ash/system/palette/palette_tray.cc
@@ -4,6 +4,8 @@ #include "ash/system/palette/palette_tray.h" +#include <memory> + #include "ash/accessibility/accessibility_delegate.h" #include "ash/public/cpp/ash_pref_names.h" #include "ash/public/cpp/config.h" @@ -234,7 +236,7 @@ local_state_pref_service_->SetBoolean(prefs::kHasSeenStylus, true); } - pref_change_registrar_ = base::MakeUnique<PrefChangeRegistrar>(); + pref_change_registrar_ = std::make_unique<PrefChangeRegistrar>(); pref_change_registrar_->Init(local_state_pref_service_); pref_change_registrar_->Add( prefs::kHasSeenStylus, @@ -477,7 +479,7 @@ bubble_view->AddChildView(view.view); // Show the bubble. - bubble_ = base::MakeUnique<TrayBubbleWrapper>(this, bubble_view); + bubble_ = std::make_unique<TrayBubbleWrapper>(this, bubble_view); SetIsActive(true); } @@ -517,7 +519,7 @@ if (has_seen_stylus_) watcher_.reset(); else - watcher_ = base::MakeUnique<StylusWatcher>(local_state_pref_service_); + watcher_ = std::make_unique<StylusWatcher>(local_state_pref_service_); UpdateIconVisibility(); }
diff --git a/ash/system/palette/palette_tray_unittest.cc b/ash/system/palette/palette_tray_unittest.cc index 715fdc8..edfab8b 100644 --- a/ash/system/palette/palette_tray_unittest.cc +++ b/ash/system/palette/palette_tray_unittest.cc
@@ -4,6 +4,8 @@ #include "ash/system/palette/palette_tray.h" +#include <memory> + #include "ash/highlighter/highlighter_controller.h" #include "ash/highlighter/highlighter_controller_test_api.h" #include "ash/public/cpp/ash_pref_names.h" @@ -50,11 +52,11 @@ palette_tray_ = StatusAreaWidgetTestHelper::GetStatusAreaWidget()->palette_tray(); - test_api_ = base::MakeUnique<PaletteTray::TestApi>(palette_tray_); + test_api_ = std::make_unique<PaletteTray::TestApi>(palette_tray_); // Set the test palette delegate here, since this requires an instance of // shell to be available. - ShellTestApi().SetPaletteDelegate(base::MakeUnique<TestPaletteDelegate>()); + ShellTestApi().SetPaletteDelegate(std::make_unique<TestPaletteDelegate>()); // Initialize the palette tray again since this test requires information // from the palette delegate. (It was initialized without the delegate in // AshTestBase::SetUp()). @@ -222,7 +224,7 @@ // ui takes ownership of the tick clock. ui::SetEventTickClockForTesting(base::WrapUnique(simulated_clock_)); - highlighter_test_api_ = base::MakeUnique<HighlighterControllerTestApi>( + highlighter_test_api_ = std::make_unique<HighlighterControllerTestApi>( Shell::Get()->highlighter_controller()); }
diff --git a/ash/system/palette/tools/create_note_unittest.cc b/ash/system/palette/tools/create_note_unittest.cc index 49f5216..6ffb810 100644 --- a/ash/system/palette/tools/create_note_unittest.cc +++ b/ash/system/palette/tools/create_note_unittest.cc
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <memory> + #include "ash/shell.h" #include "ash/shell_test_api.h" #include "ash/system/palette/mock_palette_tool_delegate.h" @@ -27,10 +29,10 @@ void SetUp() override { AshTestBase::SetUp(); - ShellTestApi().SetPaletteDelegate(base::MakeUnique<TestPaletteDelegate>()); + ShellTestApi().SetPaletteDelegate(std::make_unique<TestPaletteDelegate>()); - palette_tool_delegate_ = base::MakeUnique<MockPaletteToolDelegate>(); - tool_ = base::MakeUnique<CreateNoteAction>(palette_tool_delegate_.get()); + palette_tool_delegate_ = std::make_unique<MockPaletteToolDelegate>(); + tool_ = std::make_unique<CreateNoteAction>(palette_tool_delegate_.get()); } TestPaletteDelegate* test_palette_delegate() {
diff --git a/ash/system/palette/tools/metalayer_unittest.cc b/ash/system/palette/tools/metalayer_unittest.cc index 14c0c67..caf5df62 100644 --- a/ash/system/palette/tools/metalayer_unittest.cc +++ b/ash/system/palette/tools/metalayer_unittest.cc
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <memory> + #include "ash/highlighter/highlighter_controller.h" #include "ash/highlighter/highlighter_controller_test_api.h" #include "ash/shell.h" @@ -32,11 +34,11 @@ void SetUp() override { AshTestBase::SetUp(); - ShellTestApi().SetPaletteDelegate(base::MakeUnique<TestPaletteDelegate>()); + ShellTestApi().SetPaletteDelegate(std::make_unique<TestPaletteDelegate>()); - palette_tool_delegate_ = base::MakeUnique<MockPaletteToolDelegate>(); - tool_ = base::MakeUnique<MetalayerMode>(palette_tool_delegate_.get()); - highlighter_test_api_ = base::MakeUnique<HighlighterControllerTestApi>( + palette_tool_delegate_ = std::make_unique<MockPaletteToolDelegate>(); + tool_ = std::make_unique<MetalayerMode>(palette_tool_delegate_.get()); + highlighter_test_api_ = std::make_unique<HighlighterControllerTestApi>( Shell::Get()->highlighter_controller()); }
diff --git a/ash/system/palette/tools/screenshot_unittest.cc b/ash/system/palette/tools/screenshot_unittest.cc index 435823c..8f6c954 100644 --- a/ash/system/palette/tools/screenshot_unittest.cc +++ b/ash/system/palette/tools/screenshot_unittest.cc
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <memory> + #include "ash/shell.h" #include "ash/shell_test_api.h" #include "ash/system/palette/mock_palette_tool_delegate.h" @@ -12,7 +14,6 @@ #include "ash/system/palette/tools/capture_screen_action.h" #include "ash/test/ash_test_base.h" #include "base/macros.h" -#include "base/memory/ptr_util.h" namespace ash { @@ -27,9 +28,9 @@ void SetUp() override { AshTestBase::SetUp(); - ShellTestApi().SetPaletteDelegate(base::MakeUnique<TestPaletteDelegate>()); + ShellTestApi().SetPaletteDelegate(std::make_unique<TestPaletteDelegate>()); - palette_tool_delegate_ = base::MakeUnique<MockPaletteToolDelegate>(); + palette_tool_delegate_ = std::make_unique<MockPaletteToolDelegate>(); } TestPaletteDelegate* test_palette_delegate() { @@ -49,7 +50,7 @@ // method. Invoking the callback passed to the delegate disables the tool. TEST_F(ScreenshotToolTest, EnablingCaptureRegionCallsDelegateAndDisablesTool) { std::unique_ptr<PaletteTool> tool = - base::MakeUnique<CaptureRegionMode>(palette_tool_delegate_.get()); + std::make_unique<CaptureRegionMode>(palette_tool_delegate_.get()); // Starting a partial screenshot calls the calls the palette delegate to start // a screenshot session and hides the palette. @@ -69,7 +70,7 @@ // disables the tool, and hides the palette. TEST_F(ScreenshotToolTest, EnablingCaptureScreenCallsDelegateAndDisablesTool) { std::unique_ptr<PaletteTool> tool = - base::MakeUnique<CaptureScreenAction>(palette_tool_delegate_.get()); + std::make_unique<CaptureScreenAction>(palette_tool_delegate_.get()); EXPECT_CALL(*palette_tool_delegate_.get(), DisableTool(PaletteToolId::CAPTURE_SCREEN)); EXPECT_CALL(*palette_tool_delegate_.get(), HidePaletteImmediately());
diff --git a/ash/system/power/peripheral_battery_notifier_unittest.cc b/ash/system/power/peripheral_battery_notifier_unittest.cc index d58a330c..88028b6 100644 --- a/ash/system/power/peripheral_battery_notifier_unittest.cc +++ b/ash/system/power/peripheral_battery_notifier_unittest.cc
@@ -4,11 +4,12 @@ #include "ash/system/power/peripheral_battery_notifier.h" +#include <memory> + #include "ash/public/cpp/config.h" #include "ash/shell.h" #include "ash/test/ash_test_base.h" #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/test/simple_test_tick_clock.h" #include "ui/events/devices/touchscreen_device.h" #include "ui/events/test/device_data_manager_test_api.h" @@ -33,7 +34,7 @@ void SetUp() override { ash::AshTestBase::SetUp(); - observer_ = base::MakeUnique<PeripheralBatteryNotifier>(); + observer_ = std::make_unique<PeripheralBatteryNotifier>(); } void TearDown() override {
diff --git a/ash/system/session/logout_button_tray.cc b/ash/system/session/logout_button_tray.cc index d2aa499b..8e37b35c 100644 --- a/ash/system/session/logout_button_tray.cc +++ b/ash/system/session/logout_button_tray.cc
@@ -4,6 +4,8 @@ #include "ash/system/session/logout_button_tray.h" +#include <memory> + #include "ash/public/cpp/ash_pref_names.h" #include "ash/public/cpp/ash_typography.h" #include "ash/resources/vector_icons/vector_icons.h" @@ -80,7 +82,7 @@ void LogoutButtonTray::OnActiveUserPrefServiceChanged(PrefService* prefs) { pref_change_registrar_.reset(); - pref_change_registrar_ = base::MakeUnique<PrefChangeRegistrar>(); + pref_change_registrar_ = std::make_unique<PrefChangeRegistrar>(); pref_change_registrar_->Init(prefs); pref_change_registrar_->Add( prefs::kShowLogoutButtonInTray,
diff --git a/ash/system/session/logout_confirmation_controller.cc b/ash/system/session/logout_confirmation_controller.cc index 6d2d867..611e936d 100644 --- a/ash/system/session/logout_confirmation_controller.cc +++ b/ash/system/session/logout_confirmation_controller.cc
@@ -4,6 +4,7 @@ #include "ash/system/session/logout_confirmation_controller.h" +#include <memory> #include <utility> #include "ash/login_status.h" @@ -108,7 +109,7 @@ }; LogoutConfirmationController::LogoutConfirmationController() - : clock_(base::MakeUnique<base::DefaultTickClock>()), + : clock_(std::make_unique<base::DefaultTickClock>()), logout_closure_(base::Bind(&SignOut)), logout_timer_(false, false), scoped_session_observer_(this) {} @@ -142,7 +143,7 @@ void LogoutConfirmationController::OnLoginStatusChanged( LoginStatus login_status) { if (login_status == LoginStatus::PUBLIC) - last_window_closed_observer_ = base::MakeUnique<LastWindowClosedObserver>(); + last_window_closed_observer_ = std::make_unique<LastWindowClosedObserver>(); else last_window_closed_observer_.reset(); }
diff --git a/ash/system/session/tray_session_length_limit_unittest.cc b/ash/system/session/tray_session_length_limit_unittest.cc index a9c7968..35ad60a8 100644 --- a/ash/system/session/tray_session_length_limit_unittest.cc +++ b/ash/system/session/tray_session_length_limit_unittest.cc
@@ -10,7 +10,6 @@ #include "ash/system/tray/system_tray.h" #include "ash/system/tray/system_tray_test_api.h" #include "ash/test/ash_test_base.h" -#include "base/memory/ptr_util.h" #include "base/time/time.h" #include "ui/message_center/message_center.h" #include "ui/message_center/notification.h"
diff --git a/ash/system/system_notifier.cc b/ash/system/system_notifier.cc index 4043d756..d7d4647a 100644 --- a/ash/system/system_notifier.cc +++ b/ash/system/system_notifier.cc
@@ -4,8 +4,9 @@ #include "ash/system/system_notifier.h" +#include <memory> + #include "base/logging.h" -#include "base/memory/ptr_util.h" #include "ui/message_center/public/cpp/message_center_switches.h" namespace ash { @@ -110,7 +111,7 @@ type, id, title, message, gfx::Image(), display_source, origin_url, notifier_id, optional_fields, delegate, small_image, color_type); } - return base::MakeUnique<message_center::Notification>( + return std::make_unique<message_center::Notification>( type, id, title, message, icon, display_source, origin_url, notifier_id, optional_fields, delegate); }
diff --git a/ash/system/tray/size_range_layout_unittest.cc b/ash/system/tray/size_range_layout_unittest.cc index a1eb5f4b..888873e 100644 --- a/ash/system/tray/size_range_layout_unittest.cc +++ b/ash/system/tray/size_range_layout_unittest.cc
@@ -2,8 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <memory> + #include "ash/system/tray/size_range_layout.h" -#include "base/memory/ptr_util.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/views/test/test_layout_manager.h" #include "ui/views/view.h" @@ -109,7 +110,7 @@ TEST_F(SizeRangeLayoutTest, InternalLayoutManagerPreferredSizeIsUsed) { const gfx::Size kSize(7, 8); std::unique_ptr<views::test::TestLayoutManager> child_layout = - base::MakeUnique<views::test::TestLayoutManager>(); + std::make_unique<views::test::TestLayoutManager>(); child_layout->SetPreferredSize(kSize); SizeRangeLayout layout; @@ -124,7 +125,7 @@ const gfx::Size kMaxSize(20, 20); const gfx::Size kLayoutPreferredSize(5, 5); std::unique_ptr<views::test::TestLayoutManager> child_layout = - base::MakeUnique<views::test::TestLayoutManager>(); + std::make_unique<views::test::TestLayoutManager>(); child_layout->SetPreferredSize(kLayoutPreferredSize); SizeRangeLayout layout; @@ -139,7 +140,7 @@ const gfx::Size kMaxSize(20, 20); const gfx::Size kLayoutPreferredSize(25, 25); std::unique_ptr<views::test::TestLayoutManager> child_layout = - base::MakeUnique<views::test::TestLayoutManager>(); + std::make_unique<views::test::TestLayoutManager>(); child_layout->SetPreferredSize(kLayoutPreferredSize); SizeRangeLayout layout; @@ -176,7 +177,7 @@ const int kWidth = 5; const int kHeight = 9; std::unique_ptr<views::test::TestLayoutManager> child_layout = - base::MakeUnique<views::test::TestLayoutManager>(); + std::make_unique<views::test::TestLayoutManager>(); child_layout->set_preferred_height_for_width(kHeight); SizeRangeLayout layout;
diff --git a/ash/system/tray/system_tray.cc b/ash/system/tray/system_tray.cc index 48c4e39..f4af961 100644 --- a/ash/system/tray/system_tray.cc +++ b/ash/system/tray/system_tray.cc
@@ -6,6 +6,7 @@ #include <algorithm> #include <map> +#include <memory> #include <vector> #include "ash/login_status.h" @@ -275,11 +276,11 @@ } void SystemTray::CreateItems() { - AddTrayItem(base::MakeUnique<TrayUser>(this)); + AddTrayItem(std::make_unique<TrayUser>(this)); // Crucially, this trailing padding has to be inside the user item(s). // Otherwise it could be a main axis margin on the tray's box layout. - AddTrayItem(base::MakeUnique<PaddingTrayItem>()); + AddTrayItem(std::make_unique<PaddingTrayItem>()); tray_session_length_limit_ = new TraySessionLengthLimit(this); AddTrayItem(base::WrapUnique(tray_session_length_limit_)); @@ -287,30 +288,30 @@ AddTrayItem(base::WrapUnique(tray_enterprise_)); tray_supervised_user_ = new TraySupervisedUser(this); AddTrayItem(base::WrapUnique(tray_supervised_user_)); - AddTrayItem(base::MakeUnique<TrayIME>(this)); + AddTrayItem(std::make_unique<TrayIME>(this)); tray_accessibility_ = new TrayAccessibility(this); AddTrayItem(base::WrapUnique(tray_accessibility_)); tray_tracing_ = new TrayTracing(this); AddTrayItem(base::WrapUnique(tray_tracing_)); AddTrayItem( - base::MakeUnique<TrayPower>(this, message_center::MessageCenter::Get())); + std::make_unique<TrayPower>(this, message_center::MessageCenter::Get())); tray_network_ = new TrayNetwork(this); AddTrayItem(base::WrapUnique(tray_network_)); - AddTrayItem(base::MakeUnique<TrayVPN>(this)); - AddTrayItem(base::MakeUnique<TrayBluetooth>(this)); + AddTrayItem(std::make_unique<TrayVPN>(this)); + AddTrayItem(std::make_unique<TrayBluetooth>(this)); tray_cast_ = new TrayCast(this); AddTrayItem(base::WrapUnique(tray_cast_)); screen_capture_tray_item_ = new ScreenCaptureTrayItem(this); AddTrayItem(base::WrapUnique(screen_capture_tray_item_)); screen_share_tray_item_ = new ScreenShareTrayItem(this); AddTrayItem(base::WrapUnique(screen_share_tray_item_)); - AddTrayItem(base::MakeUnique<MultiProfileMediaTrayItem>(this)); + AddTrayItem(std::make_unique<MultiProfileMediaTrayItem>(this)); tray_audio_ = new TrayAudio(this); AddTrayItem(base::WrapUnique(tray_audio_)); tray_scale_ = new TrayScale(this); AddTrayItem(base::WrapUnique(tray_scale_)); - AddTrayItem(base::MakeUnique<TrayBrightness>(this)); - AddTrayItem(base::MakeUnique<TrayKeyboardBrightness>(this)); + AddTrayItem(std::make_unique<TrayBrightness>(this)); + AddTrayItem(std::make_unique<TrayKeyboardBrightness>(this)); tray_caps_lock_ = new TrayCapsLock(this); AddTrayItem(base::WrapUnique(tray_caps_lock_)); if (NightLightController::IsFeatureEnabled()) { @@ -320,7 +321,7 @@ // TODO(jamescook): Remove this when mash has support for display management // and we have a DisplayManager equivalent. See http://crbug.com/548429 if (Shell::GetAshConfig() != Config::MASH) - AddTrayItem(base::MakeUnique<TrayRotationLock>(this)); + AddTrayItem(std::make_unique<TrayRotationLock>(this)); tray_update_ = new TrayUpdate(this); AddTrayItem(base::WrapUnique(tray_update_)); tray_tiles_ = new TrayTiles(this); @@ -328,7 +329,7 @@ tray_system_info_ = new TraySystemInfo(this); AddTrayItem(base::WrapUnique(tray_system_info_)); // Leading padding. - AddTrayItem(base::MakeUnique<PaddingTrayItem>()); + AddTrayItem(std::make_unique<PaddingTrayItem>()); } void SystemTray::AddTrayItem(std::unique_ptr<SystemTrayItem> item) {
diff --git a/ash/system/tray/system_tray_unittest.cc b/ash/system/tray/system_tray_unittest.cc index 52e39f11..8068511 100644 --- a/ash/system/tray/system_tray_unittest.cc +++ b/ash/system/tray/system_tray_unittest.cc
@@ -4,6 +4,7 @@ #include "ash/system/tray/system_tray.h" +#include <memory> #include <string> #include <vector> @@ -456,9 +457,8 @@ SystemTray* tray = GetPrimarySystemTray(); ASSERT_TRUE(tray->GetWidget()); - TestSystemTrayItem* test_item = - new TestSystemTrayItem(SystemTrayItem::UMA_NOT_RECORDED); - tray->AddTrayItem(base::WrapUnique(test_item)); + tray->AddTrayItem( + std::make_unique<TestSystemTrayItem>(SystemTrayItem::UMA_NOT_RECORDED)); base::HistogramTester histogram_tester; @@ -478,9 +478,9 @@ SystemTray* tray = GetPrimarySystemTray(); ASSERT_TRUE(tray->GetWidget()); - TestSystemTrayItem* test_item = new TestSystemTrayItem(); + auto test_item = std::make_unique<TestSystemTrayItem>(); test_item->set_has_views(false); - tray->AddTrayItem(base::WrapUnique(test_item)); + tray->AddTrayItem(std::move(test_item)); base::HistogramTester histogram_tester; @@ -824,8 +824,7 @@ SystemTray* tray = GetPrimarySystemTray(); ASSERT_TRUE(tray->GetWidget()); - TestSystemTrayItem* test_item = new TestSystemTrayItem(); - tray->AddTrayItem(base::WrapUnique(test_item)); + tray->AddTrayItem(std::make_unique<TestSystemTrayItem>()); std::unique_ptr<views::Widget> widget(CreateTestWidget( nullptr, kShellWindowId_DefaultContainer, gfx::Rect(0, 0, 100, 100)));
diff --git a/ash/system/tray/tray_background_view.cc b/ash/system/tray/tray_background_view.cc index cc9c9fc8..9f0a8631 100644 --- a/ash/system/tray/tray_background_view.cc +++ b/ash/system/tray/tray_background_view.cc
@@ -5,6 +5,7 @@ #include "ash/system/tray/tray_background_view.h" #include <algorithm> +#include <memory> #include "ash/ash_constants.h" #include "ash/focus_cycler.h" @@ -20,7 +21,6 @@ #include "ash/system/tray/tray_container.h" #include "ash/system/tray/tray_event_filter.h" #include "ash/wm/tablet_mode/tablet_mode_controller.h" -#include "base/memory/ptr_util.h" #include "ui/accessibility/ax_node_data.h" #include "ui/compositor/layer.h" #include "ui/compositor/layer_animation_element.h" @@ -299,7 +299,7 @@ std::unique_ptr<views::InkDropRipple> TrayBackgroundView::CreateInkDropRipple() const { - return base::MakeUnique<views::FloodFillInkDropRipple>( + return std::make_unique<views::FloodFillInkDropRipple>( size(), GetBackgroundInsets(), GetInkDropCenterBasedOnLastEvent(), GetInkDropBaseColor(), ink_drop_visible_opacity()); } @@ -474,7 +474,7 @@ ->tablet_mode_controller() ->IsTabletModeWindowManagerEnabled()) { if (!clipping_window_.get()) { - clipping_window_ = base::MakeUnique<aura::Window>(nullptr); + clipping_window_ = std::make_unique<aura::Window>(nullptr); clipping_window_->Init(ui::LAYER_NOT_DRAWN); clipping_window_->layer()->SetMasksToBounds(true); container->AddChild(clipping_window_.get()); @@ -511,7 +511,7 @@ std::unique_ptr<views::InkDropMask> TrayBackgroundView::CreateInkDropMask() const { - return base::MakeUnique<views::RoundRectInkDropMask>( + return std::make_unique<views::RoundRectInkDropMask>( size(), GetBackgroundInsets(), kTrayRoundedBorderRadius); }
diff --git a/ash/system/tray/tray_details_view.cc b/ash/system/tray/tray_details_view.cc index 1c7992f8..7d238567 100644 --- a/ash/system/tray/tray_details_view.cc +++ b/ash/system/tray/tray_details_view.cc
@@ -15,7 +15,6 @@ #include "ash/system/tray/tray_popup_utils.h" #include "ash/system/tray/tri_view.h" #include "base/containers/adapters.h" -#include "base/memory/ptr_util.h" #include "third_party/skia/include/core/SkDrawLooper.h" #include "ui/base/l10n/l10n_util.h" #include "ui/base/resource/resource_bundle.h"
diff --git a/ash/system/tray/tray_info_label_unittest.cc b/ash/system/tray/tray_info_label_unittest.cc index 726ded37..d46f0cbd 100644 --- a/ash/system/tray/tray_info_label_unittest.cc +++ b/ash/system/tray/tray_info_label_unittest.cc
@@ -4,6 +4,8 @@ #include "ash/system/tray/tray_info_label.h" +#include <memory> + #include "ash/strings/grit/ash_strings.h" #include "ash/test/ash_test_base.h" #include "testing/gtest/include/gtest/gtest.h" @@ -56,9 +58,9 @@ void CreateLabel(bool use_delegate, int message_id) { if (use_delegate) - delegate_ = base::MakeUnique<TestDelegate>(); + delegate_ = std::make_unique<TestDelegate>(); - label_ = base::MakeUnique<TrayInfoLabel>(delegate_.get(), message_id); + label_ = std::make_unique<TrayInfoLabel>(delegate_.get(), message_id); } void ClickOnLabel(bool expect_click_was_handled) {
diff --git a/ash/system/tray/tray_item_more.cc b/ash/system/tray/tray_item_more.cc index 405c124..467aa67f 100644 --- a/ash/system/tray/tray_item_more.cc +++ b/ash/system/tray/tray_item_more.cc
@@ -4,12 +4,13 @@ #include "ash/system/tray/tray_item_more.h" +#include <memory> + #include "ash/system/tray/system_tray_item.h" #include "ash/system/tray/tray_constants.h" #include "ash/system/tray/tray_popup_item_style.h" #include "ash/system/tray/tray_popup_utils.h" #include "ash/system/tray/tri_view.h" -#include "base/memory/ptr_util.h" #include "ui/accessibility/ax_node_data.h" #include "ui/gfx/image/image.h" #include "ui/views/controls/image_view.h" @@ -55,7 +56,7 @@ } std::unique_ptr<TrayPopupItemStyle> TrayItemMore::HandleCreateStyle() const { - return base::MakeUnique<TrayPopupItemStyle>( + return std::make_unique<TrayPopupItemStyle>( TrayPopupItemStyle::FontStyle::DEFAULT_VIEW_LABEL); }
diff --git a/ash/system/tray/tray_popup_utils.cc b/ash/system/tray/tray_popup_utils.cc index d84b7fd6..1bdbf8bb 100644 --- a/ash/system/tray/tray_popup_utils.cc +++ b/ash/system/tray/tray_popup_utils.cc
@@ -5,6 +5,7 @@ #include "ash/system/tray/tray_popup_utils.h" #include <algorithm> +#include <memory> #include <utility> #include "ash/ash_constants.h" @@ -16,7 +17,6 @@ #include "ash/system/tray/size_range_layout.h" #include "ash/system/tray/tray_constants.h" #include "ash/system/tray/tray_popup_item_style.h" -#include "base/memory/ptr_util.h" #include "ui/base/l10n/l10n_util.h" #include "ui/gfx/color_palette.h" #include "ui/gfx/geometry/insets.h" @@ -49,7 +49,7 @@ // stretched horizontally and centered vertically. std::unique_ptr<views::LayoutManager> CreateDefaultCenterLayoutManager() { // TODO(bruthig): Use constants instead of magic numbers. - auto box_layout = base::MakeUnique<views::BoxLayout>( + auto box_layout = std::make_unique<views::BoxLayout>( views::BoxLayout::kVertical, gfx::Insets(8, kTrayPopupLabelHorizontalPadding)); box_layout->set_main_axis_alignment( @@ -63,7 +63,7 @@ // centered along the horizontal and vertical axis. std::unique_ptr<views::LayoutManager> CreateDefaultEndsLayoutManager() { auto box_layout = - base::MakeUnique<views::BoxLayout>(views::BoxLayout::kHorizontal); + std::make_unique<views::BoxLayout>(views::BoxLayout::kHorizontal); box_layout->set_main_axis_alignment( views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); box_layout->set_cross_axis_alignment( @@ -197,11 +197,11 @@ ConfigureDefaultSizeAndFlex(tri_view, TriView::Container::END); tri_view->SetContainerLayout(TriView::Container::START, - base::MakeUnique<views::FillLayout>()); + std::make_unique<views::FillLayout>()); tri_view->SetContainerLayout(TriView::Container::CENTER, - base::MakeUnique<views::FillLayout>()); + std::make_unique<views::FillLayout>()); tri_view->SetContainerLayout(TriView::Container::END, - base::MakeUnique<views::FillLayout>()); + std::make_unique<views::FillLayout>()); return tri_view; } @@ -325,7 +325,7 @@ TrayPopupInkDropStyle ink_drop_style, views::InkDropHostView* host) { std::unique_ptr<views::InkDropImpl> ink_drop = - base::MakeUnique<views::InkDropImpl>(host, host->size()); + std::make_unique<views::InkDropImpl>(host, host->size()); ink_drop->SetAutoHighlightMode( views::InkDropImpl::AutoHighlightMode::SHOW_ON_RIPPLE); ink_drop->SetShowHighlightOnHover(false); @@ -338,7 +338,7 @@ const views::View* host, const gfx::Point& center_point, SkColor color) { - return base::MakeUnique<views::FloodFillInkDropRipple>( + return std::make_unique<views::FloodFillInkDropRipple>( host->size(), TrayPopupUtils::GetInkDropInsets(ink_drop_style), center_point, color, kTrayPopupInkDropRippleOpacity); } @@ -369,13 +369,13 @@ GetInkDropBounds(TrayPopupInkDropStyle::HOST_CENTERED, host); const int radius = std::min(mask_bounds.width(), mask_bounds.height()) / 2; - return base::MakeUnique<views::CircleInkDropMask>( + return std::make_unique<views::CircleInkDropMask>( layer_size, mask_bounds.CenterPoint(), radius); } case TrayPopupInkDropStyle::INSET_BOUNDS: { const gfx::Insets mask_insets = GetInkDropInsets(TrayPopupInkDropStyle::INSET_BOUNDS); - return base::MakeUnique<views::RoundRectInkDropMask>( + return std::make_unique<views::RoundRectInkDropMask>( layer_size, mask_insets, kTrayPopupInkDropCornerRadius); } case TrayPopupInkDropStyle::FILL_BOUNDS:
diff --git a/ash/system/tray/tri_view_unittest.cc b/ash/system/tray/tri_view_unittest.cc index 52dcc4e3..7533b06 100644 --- a/ash/system/tray/tri_view_unittest.cc +++ b/ash/system/tray/tri_view_unittest.cc
@@ -6,7 +6,6 @@ #include <utility> #include "ash/system/tray/tri_view.h" -#include "base/memory/ptr_util.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/gfx/geometry/insets.h" #include "ui/gfx/geometry/rect_conversions.h" @@ -22,7 +21,7 @@ // size. std::unique_ptr<views::LayoutManager> CreatePreferredSizeLayoutManager() { auto layout = - base::MakeUnique<views::BoxLayout>(views::BoxLayout::kHorizontal); + std::make_unique<views::BoxLayout>(views::BoxLayout::kHorizontal); layout->set_cross_axis_alignment( views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); return std::move(layout); @@ -52,7 +51,7 @@ DISALLOW_COPY_AND_ASSIGN(TriViewTest); }; -TriViewTest::TriViewTest() : tri_view_(base::MakeUnique<TriView>()) {} +TriViewTest::TriViewTest() : tri_view_(std::make_unique<TriView>()) {} int TriViewTest::GetMinHeight(TriView::Container container) const { return tri_view_->GetMinSize(container).height(); @@ -79,7 +78,7 @@ const int kEndChildExpectedX = kCenterChildExpectedX + kViewWidth + kPaddingBetweenContainers; - tri_view_ = base::MakeUnique<TriView>(kPaddingBetweenContainers); + tri_view_ = std::make_unique<TriView>(kPaddingBetweenContainers); tri_view_->SetBounds(0, 0, 100, 10); views::View* start_child = new views::StaticSizedView(kViewSize); @@ -102,7 +101,7 @@ const int kViewHeight = 10; const gfx::Size kViewSize(kViewWidth, kViewHeight); - tri_view_ = base::MakeUnique<TriView>(TriView::Orientation::VERTICAL); + tri_view_ = std::make_unique<TriView>(TriView::Orientation::VERTICAL); tri_view_->SetBounds(0, 0, 10, 100); views::View* start_child = new views::StaticSizedView(kViewSize);
diff --git a/ash/system/tray_accessibility.cc b/ash/system/tray_accessibility.cc index 012aa3c..132eabe 100644 --- a/ash/system/tray_accessibility.cc +++ b/ash/system/tray_accessibility.cc
@@ -498,7 +498,7 @@ GetNotificationIcon(being_enabled), message_center::SystemNotificationWarningLevel::NORMAL); } else { - notification = base::MakeUnique<message_center::Notification>( + notification = std::make_unique<message_center::Notification>( message_center::NOTIFICATION_TYPE_SIMPLE, kNotificationId, title, text, gfx::Image(gfx::CreateVectorIcon(GetNotificationIcon(being_enabled), kMenuIconSize, kMenuIconColor)),
diff --git a/ash/system/tray_caps_lock.cc b/ash/system/tray_caps_lock.cc index 790b11e..ae75313 100644 --- a/ash/system/tray_caps_lock.cc +++ b/ash/system/tray_caps_lock.cc
@@ -4,6 +4,8 @@ #include "ash/system/tray_caps_lock.h" +#include <memory> + #include "ash/accessibility/accessibility_delegate.h" #include "ash/ime/ime_controller.h" #include "ash/metrics/user_metrics_recorder.h" @@ -86,7 +88,7 @@ kNotificationCapslockIcon, message_center::SystemNotificationWarningLevel::NORMAL); } else { - notification = base::MakeUnique<Notification>( + notification = std::make_unique<Notification>( message_center::NOTIFICATION_TYPE_SIMPLE, kCapsLockNotificationId, l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_CAPS_LOCK_ENABLED), l10n_util::GetStringUTF16(string_id),
diff --git a/ash/system/user/user_view.cc b/ash/system/user/user_view.cc index 6499684..7d0d48e 100644 --- a/ash/system/user/user_view.cc +++ b/ash/system/user/user_view.cc
@@ -5,6 +5,7 @@ #include "ash/system/user/user_view.h" #include <algorithm> +#include <memory> #include <utility> #include "ash/metrics/user_metrics_recorder.h" @@ -24,7 +25,6 @@ #include "ash/system/user/login_status.h" #include "ash/system/user/rounded_image_view.h" #include "ash/system/user/user_card_view.h" -#include "base/memory/ptr_util.h" #include "components/signin/core/account_id/account_id.h" #include "components/user_manager/user_info.h" #include "ui/base/l10n/l10n_util.h" @@ -225,7 +225,7 @@ views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); layout->SetFlexForView(user_card_container_, 1); - SetBorder(base::MakeUnique<ActiveUserBorder>()); + SetBorder(std::make_unique<ActiveUserBorder>()); } UserView::~UserView() {
diff --git a/ash/system/web_notification/ash_popup_alignment_delegate_unittest.cc b/ash/system/web_notification/ash_popup_alignment_delegate_unittest.cc index 3e2c740..8234a14 100644 --- a/ash/system/web_notification/ash_popup_alignment_delegate_unittest.cc +++ b/ash/system/web_notification/ash_popup_alignment_delegate_unittest.cc
@@ -4,6 +4,7 @@ #include "ash/system/web_notification/ash_popup_alignment_delegate.h" +#include <memory> #include <utility> #include <vector> @@ -15,7 +16,6 @@ #include "ash/shell.h" #include "ash/test/ash_test_base.h" #include "base/command_line.h" -#include "base/memory/ptr_util.h" #include "ui/display/manager/display_manager.h" #include "ui/display/screen.h" #include "ui/gfx/geometry/rect.h" @@ -35,7 +35,7 @@ keyboard::switches::kEnableVirtualKeyboard); AshTestBase::SetUp(); SetAlignmentDelegate( - base::MakeUnique<AshPopupAlignmentDelegate>(GetPrimaryShelf())); + std::make_unique<AshPopupAlignmentDelegate>(GetPrimaryShelf())); } void TearDown() override { @@ -206,7 +206,7 @@ TEST_F(AshPopupAlignmentDelegateTest, Extended) { UpdateDisplay("600x600,800x800"); SetAlignmentDelegate( - base::MakeUnique<AshPopupAlignmentDelegate>(GetPrimaryShelf())); + std::make_unique<AshPopupAlignmentDelegate>(GetPrimaryShelf())); display::Display second_display = GetSecondaryDisplay(); Shelf* second_shelf = @@ -232,7 +232,7 @@ UpdateDisplay("600x600,800x800"); SetAlignmentDelegate( - base::MakeUnique<AshPopupAlignmentDelegate>(GetPrimaryShelf())); + std::make_unique<AshPopupAlignmentDelegate>(GetPrimaryShelf())); EXPECT_GT(600, alignment_delegate()->GetToastOriginX(gfx::Rect(0, 0, 10, 10)));
diff --git a/ash/system/web_notification/login_state_notification_blocker_unittest.cc b/ash/system/web_notification/login_state_notification_blocker_unittest.cc index 06af74f9..86e18a7 100644 --- a/ash/system/web_notification/login_state_notification_blocker_unittest.cc +++ b/ash/system/web_notification/login_state_notification_blocker_unittest.cc
@@ -11,7 +11,6 @@ #include "ash/test/ash_test_base.h" #include "base/command_line.h" #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/strings/utf_string_conversions.h" #include "ui/message_center/message_center.h" #include "ui/message_center/notification.h"
diff --git a/ash/system/web_notification/web_notification_tray.cc b/ash/system/web_notification/web_notification_tray.cc index 57af3f2..e95c085f 100644 --- a/ash/system/web_notification/web_notification_tray.cc +++ b/ash/system/web_notification/web_notification_tray.cc
@@ -4,6 +4,8 @@ #include "ash/system/web_notification/web_notification_tray.h" +#include <memory> + #include "ash/accessibility/accessibility_delegate.h" #include "ash/message_center/message_center_bubble.h" #include "ash/resources/vector_icons/vector_icons.h" @@ -538,7 +540,7 @@ if (visible_small_icons_.count(notification->id()) != 0) continue; - auto item = base::MakeUnique<WebNotificationImage>( + auto item = std::make_unique<WebNotificationImage>( image.AsImageSkia(), animation_container_.get(), this); tray_container()->AddChildViewAt(item.get(), 0); item->SetVisible(true);
diff --git a/ash/system/web_notification/web_notification_tray_unittest.cc b/ash/system/web_notification/web_notification_tray_unittest.cc index ad83ba8..efd39c84 100644 --- a/ash/system/web_notification/web_notification_tray_unittest.cc +++ b/ash/system/web_notification/web_notification_tray_unittest.cc
@@ -4,6 +4,7 @@ #include "ash/system/web_notification/web_notification_tray.h" +#include <memory> #include <utility> #include <vector> @@ -23,7 +24,6 @@ #include "ash/system/web_notification/ash_popup_alignment_delegate.h" #include "ash/test/ash_test_base.h" #include "ash/wm/window_state.h" -#include "base/memory/ptr_util.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "ui/display/display.h" @@ -283,8 +283,7 @@ // RootWindow's bound can be bigger than display::Display's work area so that // openingsystem tray doesn't affect at all the work area of popups. TEST_F(WebNotificationTrayTest, PopupAndSystemTray) { - TestItem* test_item = new TestItem; - GetSystemTray()->AddTrayItem(base::WrapUnique(test_item)); + GetSystemTray()->AddTrayItem(std::make_unique<TestItem>()); AddNotification("test_id"); EXPECT_TRUE(GetTray()->IsPopupVisible()); @@ -321,8 +320,7 @@ // Create the system tray during auto-hide. widget = CreateTestWidget(); - TestItem* test_item = new TestItem; - GetSystemTray()->AddTrayItem(base::WrapUnique(test_item)); + GetSystemTray()->AddTrayItem(std::make_unique<TestItem>()); GetSystemTray()->ShowDefaultView(BUBBLE_CREATE_NEW, false /* show_by_click */); UpdateAutoHideStateNow();
diff --git a/ash/test/ash_test_base.cc b/ash/test/ash_test_base.cc index b773683..044c04c 100644 --- a/ash/test/ash_test_base.cc +++ b/ash/test/ash_test_base.cc
@@ -4,6 +4,7 @@ #include "ash/test/ash_test_base.h" +#include <memory> #include <string> #include <vector> @@ -25,6 +26,7 @@ #include "ash/test/ash_test_helper.h" #include "ash/test_shell_delegate.h" #include "ash/wm/window_positioner.h" +#include "base/memory/ptr_util.h" #include "components/signin/core/account_id/account_id.h" #include "services/ui/public/cpp/property_type_converters.h" #include "services/ui/public/interfaces/window_manager.mojom.h" @@ -312,7 +314,7 @@ const gfx::Rect& bounds, int shell_window_id) { std::unique_ptr<aura::Window> window = - base::MakeUnique<aura::Window>(nullptr, aura::client::WINDOW_TYPE_NORMAL); + std::make_unique<aura::Window>(nullptr, aura::client::WINDOW_TYPE_NORMAL); window->Init(ui::LAYER_NOT_DRAWN); window->SetBounds(bounds); window->set_id(shell_window_id);
diff --git a/ash/test/ash_test_environment_content.cc b/ash/test/ash_test_environment_content.cc index fd05e29..f70b3dd5 100644 --- a/ash/test/ash_test_environment_content.cc +++ b/ash/test/ash_test_environment_content.cc
@@ -4,9 +4,10 @@ #include "ash/test/ash_test_environment_content.h" +#include <memory> + #include "ash/test/ash_test_views_delegate.h" #include "ash/test/content/test_shell_content_state.h" -#include "base/memory/ptr_util.h" #include "content/public/test/test_browser_thread_bundle.h" #include "content/public/test/web_contents_tester.h" @@ -34,7 +35,7 @@ // static std::unique_ptr<AshTestEnvironment> AshTestEnvironment::Create() { - return base::MakeUnique<AshTestEnvironmentContent>(); + return std::make_unique<AshTestEnvironmentContent>(); } // static @@ -43,7 +44,7 @@ } AshTestEnvironmentContent::AshTestEnvironmentContent() - : thread_bundle_(base::MakeUnique<content::TestBrowserThreadBundle>()) {} + : thread_bundle_(std::make_unique<content::TestBrowserThreadBundle>()) {} AshTestEnvironmentContent::~AshTestEnvironmentContent() {} @@ -62,7 +63,7 @@ std::unique_ptr<AshTestViewsDelegate> AshTestEnvironmentContent::CreateViewsDelegate() { - return base::MakeUnique<AshTestViewsDelegateContent>(); + return std::make_unique<AshTestViewsDelegateContent>(); } } // namespace ash
diff --git a/ash/test/ash_test_environment_default.cc b/ash/test/ash_test_environment_default.cc index bcba280..1347dfd 100644 --- a/ash/test/ash_test_environment_default.cc +++ b/ash/test/ash_test_environment_default.cc
@@ -4,8 +4,9 @@ #include "ash/test/ash_test_environment.h" +#include <memory> + #include "ash/test/ash_test_views_delegate.h" -#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "base/test/scoped_task_environment.h" @@ -24,7 +25,7 @@ // AshTestEnvironment: std::unique_ptr<AshTestViewsDelegate> CreateViewsDelegate() override { - return base::MakeUnique<AshTestViewsDelegate>(); + return std::make_unique<AshTestViewsDelegate>(); } private: @@ -37,7 +38,7 @@ // static std::unique_ptr<AshTestEnvironment> AshTestEnvironment::Create() { - return base::MakeUnique<AshTestEnvironmentDefault>(); + return std::make_unique<AshTestEnvironmentDefault>(); } // static
diff --git a/ash/test/ash_test_helper.cc b/ash/test/ash_test_helper.cc index b992ed5d..9567bb6 100644 --- a/ash/test/ash_test_helper.cc +++ b/ash/test/ash_test_helper.cc
@@ -5,6 +5,7 @@ #include "ash/test/ash_test_helper.h" #include <algorithm> +#include <memory> #include <set> #include "ash/accelerators/accelerator_controller_delegate_classic.h" @@ -23,7 +24,6 @@ #include "ash/test/ash_test_views_delegate.h" #include "ash/test_screenshot_delegate.h" #include "ash/test_shell_delegate.h" -#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "base/strings/string_split.h" #include "base/test/sequenced_worker_pool_owner.h" @@ -75,7 +75,7 @@ AshTestHelper::~AshTestHelper() {} void AshTestHelper::SetUp(bool start_session, bool provide_local_state) { - command_line_ = base::MakeUnique<base::test::ScopedCommandLine>(); + command_line_ = std::make_unique<base::test::ScopedCommandLine>(); // TODO(jamescook): Can we do this without changing command line? // Use the origin (1,1) so that it doesn't over // lap with the native mouse cursor. @@ -98,14 +98,14 @@ } if (config_ == Config::MUS) - input_device_client_ = base::MakeUnique<ui::InputDeviceClient>(); + input_device_client_ = std::make_unique<ui::InputDeviceClient>(); display::ResetDisplayIdForTest(); if (config_ != Config::CLASSIC) aura::test::EnvTestHelper().SetAlwaysUseLastMouseLocation(true); // WindowManager creates WMState for mash. if (config_ == Config::CLASSIC) - wm_state_ = base::MakeUnique<::wm::WMState>(); + wm_state_ = std::make_unique<::wm::WMState>(); test_views_delegate_ = ash_test_environment_->CreateViewsDelegate(); // Disable animations during tests. @@ -163,7 +163,7 @@ Shell* shell = Shell::Get(); if (provide_local_state) { - auto pref_service = base::MakeUnique<TestingPrefServiceSimple>(); + auto pref_service = std::make_unique<TestingPrefServiceSimple>(); Shell::RegisterLocalStatePrefs(pref_service->registry()); Shell::Get()->OnLocalStatePrefServiceInitialized(std::move(pref_service)); } @@ -276,7 +276,7 @@ void AshTestHelper::CreateMashWindowManager() { CHECK(config_ != Config::CLASSIC); const bool show_primary_root_on_connect = false; - window_manager_app_ = base::MakeUnique<mus::WindowManagerApplication>( + window_manager_app_ = std::make_unique<mus::WindowManagerApplication>( show_primary_root_on_connect); window_manager_app_->window_manager_.reset( @@ -299,7 +299,7 @@ aura::WindowTreeClient* window_tree_client = window_manager_app_->window_manager()->window_tree_client(); window_tree_client_private_ = - base::MakeUnique<aura::WindowTreeClientPrivate>(window_tree_client); + std::make_unique<aura::WindowTreeClientPrivate>(window_tree_client); window_tree_client_private_->CallOnConnect(); }
diff --git a/ash/test/ash_test_suite.cc b/ash/test/ash_test_suite.cc index b64d083..100b1e9 100644 --- a/ash/test/ash_test_suite.cc +++ b/ash/test/ash_test_suite.cc
@@ -4,6 +4,7 @@ #include "ash/test/ash_test_suite.h" +#include <memory> #include <set> #include "ash/public/cpp/config.h" @@ -67,11 +68,11 @@ scoped_refptr<cc::TestContextProvider> context_provider = cc::TestContextProvider::Create(); std::unique_ptr<FrameSinkClient> frame_sink_client = - base::MakeUnique<FrameSinkClient>(context_provider); + std::make_unique<FrameSinkClient>(context_provider); constexpr bool synchronous_composite = false; constexpr bool disable_display_vsync = false; const double refresh_rate = GetRefreshRate(); - auto frame_sink = base::MakeUnique<viz::TestLayerTreeFrameSink>( + auto frame_sink = std::make_unique<viz::TestLayerTreeFrameSink>( context_provider, cc::TestContextProvider::CreateWorker(), nullptr, GetGpuMemoryBufferManager(), renderer_settings(), base::ThreadTaskRunnerHandle::Get().get(), synchronous_composite, @@ -138,7 +139,7 @@ : aura::Env::Mode::LOCAL); if (is_mus || is_mash) { - context_factory_ = base::MakeUnique<AshTestContextFactory>(); + context_factory_ = std::make_unique<AshTestContextFactory>(); env_->set_context_factory(context_factory_.get()); env_->set_context_factory_private(nullptr); }
diff --git a/ash/test/child_modal_window.cc b/ash/test/child_modal_window.cc index 426d8710..aee3e48 100644 --- a/ash/test/child_modal_window.cc +++ b/ash/test/child_modal_window.cc
@@ -4,7 +4,8 @@ #include "ash/test/child_modal_window.h" -#include "base/memory/ptr_util.h" +#include <memory> + #include "base/strings/utf_string_conversions.h" #include "ui/aura/window.h" #include "ui/gfx/canvas.h" @@ -103,7 +104,7 @@ } ChildModalParent::ChildModalParent(aura::Window* context) - : widget_(base::MakeUnique<Widget>()), + : widget_(std::make_unique<Widget>()), button_(new views::LabelButton( this, base::ASCIIToUTF16("Show/Hide Child Modal Window"))),
diff --git a/ash/touch/touch_hud_projection.cc b/ash/touch/touch_hud_projection.cc index 5477e3d..4da1329b 100644 --- a/ash/touch/touch_hud_projection.cc +++ b/ash/touch/touch_hud_projection.cc
@@ -7,7 +7,6 @@ #include "ash/root_window_controller.h" #include "ash/shell.h" #include "ash/touch_hud/touch_hud_renderer.h" -#include "base/memory/ptr_util.h" #include "ui/events/event.h" #include "ui/views/widget/widget.h"
diff --git a/ash/touch_hud/mus/touch_hud_application.cc b/ash/touch_hud/mus/touch_hud_application.cc index 01a6fa3..b6b5d4a 100644 --- a/ash/touch_hud/mus/touch_hud_application.cc +++ b/ash/touch_hud/mus/touch_hud_application.cc
@@ -4,10 +4,11 @@ #include "ash/touch_hud/mus/touch_hud_application.h" +#include <utility> + #include "ash/public/cpp/shell_window_ids.h" #include "ash/touch_hud/touch_hud_renderer.h" #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "base/strings/utf_string_conversions.h" #include "services/service_manager/public/cpp/connector.h"
diff --git a/ash/tray_action/tray_action_unittest.cc b/ash/tray_action/tray_action_unittest.cc index eef49333..c4664491 100644 --- a/ash/tray_action/tray_action_unittest.cc +++ b/ash/tray_action/tray_action_unittest.cc
@@ -12,7 +12,6 @@ #include "ash/tray_action/test_tray_action_client.h" #include "ash/tray_action/tray_action_observer.h" #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/run_loop.h" using ash::mojom::TrayActionState; @@ -69,7 +68,7 @@ EXPECT_EQ(0u, observer.observed_states().size()); std::unique_ptr<TestTrayActionClient> action_client = - base::MakeUnique<TestTrayActionClient>(); + std::make_unique<TestTrayActionClient>(); tray_action->SetClient(action_client->CreateInterfacePtrAndBind(), TrayActionState::kLaunching);
diff --git a/ash/utility/screenshot_controller.cc b/ash/utility/screenshot_controller.cc index 509d013a..bd1c38c 100644 --- a/ash/utility/screenshot_controller.cc +++ b/ash/utility/screenshot_controller.cc
@@ -5,6 +5,7 @@ #include "ash/utility/screenshot_controller.h" #include <cmath> +#include <memory> #include "ash/display/mouse_cursor_event_filter.h" #include "ash/public/cpp/shell_window_ids.h" @@ -12,7 +13,6 @@ #include "ash/shell.h" #include "ash/shell_port.h" #include "ash/wm/window_util.h" -#include "base/memory/ptr_util.h" #include "ui/aura/client/capture_client.h" #include "ui/aura/client/screen_position_client.h" #include "ui/aura/window_targeter.h" @@ -80,7 +80,7 @@ public: ScreenshotLayer(ui::Layer* parent, bool immediate_overlay) : draw_inactive_overlay_(immediate_overlay) { - SetLayer(base::MakeUnique<ui::Layer>(ui::LAYER_TEXTURED)); + SetLayer(std::make_unique<ui::Layer>(ui::LAYER_TEXTURED)); layer()->SetFillsBoundsOpaquely(false); layer()->SetBounds(parent->bounds()); parent->Add(layer()); @@ -285,7 +285,7 @@ display::Screen::GetScreen()->AddObserver(this); for (aura::Window* root : Shell::GetAllRootWindows()) { - layers_[root] = base::MakeUnique<ScreenshotLayer>( + layers_[root] = std::make_unique<ScreenshotLayer>( Shell::GetContainer(root, kShellWindowId_OverlayContainer)->layer(), true); } @@ -310,7 +310,7 @@ mode_ = PARTIAL; display::Screen::GetScreen()->AddObserver(this); for (aura::Window* root : Shell::GetAllRootWindows()) { - layers_[root] = base::MakeUnique<ScreenshotLayer>( + layers_[root] = std::make_unique<ScreenshotLayer>( Shell::GetContainer(root, kShellWindowId_OverlayContainer)->layer(), draw_overlay_immediately); }
diff --git a/ash/wallpaper/wallpaper_controller.cc b/ash/wallpaper/wallpaper_controller.cc index e0b4c92..01f557c 100644 --- a/ash/wallpaper/wallpaper_controller.cc +++ b/ash/wallpaper/wallpaper_controller.cc
@@ -4,6 +4,7 @@ #include "ash/wallpaper/wallpaper_controller.h" +#include <memory> #include <string> #include <utility> @@ -63,7 +64,7 @@ } DictionaryPrefUpdate wallpaper_colors_update( Shell::Get()->GetLocalStatePrefService(), prefs::kWallpaperColors); - auto wallpaper_colors = base::MakeUnique<base::ListValue>(); + auto wallpaper_colors = std::make_unique<base::ListValue>(); for (SkColor color : colors) wallpaper_colors->AppendDouble(static_cast<double>(color)); wallpaper_colors_update->SetWithoutPathExpansion(current_location, @@ -519,7 +520,7 @@ return; } - color_calculator_ = base::MakeUnique<wallpaper::WallpaperColorCalculator>( + color_calculator_ = std::make_unique<wallpaper::WallpaperColorCalculator>( GetWallpaper(), color_profiles_, sequenced_task_runner_); color_calculator_->AddObserver(this); if (!color_calculator_->StartCalculation()) {
diff --git a/ash/wayland/wayland_server_controller.cc b/ash/wayland/wayland_server_controller.cc index 0a6d40d1..35b9849 100644 --- a/ash/wayland/wayland_server_controller.cc +++ b/ash/wayland/wayland_server_controller.cc
@@ -4,9 +4,12 @@ #include "ash/wayland/wayland_server_controller.h" +#include <memory> + #include "ash/public/cpp/ash_switches.h" #include "ash/public/cpp/config.h" #include "base/command_line.h" +#include "base/memory/ptr_util.h" #include "base/message_loop/message_loop.h" #include "components/exo/display.h" #include "components/exo/file_helper.h"
diff --git a/ash/window_user_data_unittest.cc b/ash/window_user_data_unittest.cc index 39a2def1..352d584 100644 --- a/ash/window_user_data_unittest.cc +++ b/ash/window_user_data_unittest.cc
@@ -8,7 +8,6 @@ #include "ash/test/ash_test_base.h" #include "ash/window_user_data.h" -#include "base/memory/ptr_util.h" #include "ui/aura/window.h" #include "ui/compositor/layer_type.h" @@ -38,7 +37,7 @@ aura::Window window(nullptr, aura::client::WINDOW_TYPE_UNKNOWN); window.Init(ui::LAYER_NOT_DRAWN); bool data_deleted = false; - user_data.Set(&window, base::MakeUnique<Data>(&data_deleted)); + user_data.Set(&window, std::make_unique<Data>(&data_deleted)); EXPECT_FALSE(data_deleted); user_data.clear(); EXPECT_TRUE(data_deleted); @@ -47,14 +46,14 @@ // Verifies Set() called with an existing window replaces the existing data. TEST_F(WindowUserDataTest, ReplaceDestroys) { WindowUserData<Data> user_data; - std::unique_ptr<aura::Window> window(base::MakeUnique<aura::Window>( + std::unique_ptr<aura::Window> window(std::make_unique<aura::Window>( nullptr, aura::client::WINDOW_TYPE_UNKNOWN)); window->Init(ui::LAYER_NOT_DRAWN); bool data1_deleted = false; - user_data.Set(window.get(), base::MakeUnique<Data>(&data1_deleted)); + user_data.Set(window.get(), std::make_unique<Data>(&data1_deleted)); EXPECT_FALSE(data1_deleted); bool data2_deleted = false; - user_data.Set(window.get(), base::MakeUnique<Data>(&data2_deleted)); + user_data.Set(window.get(), std::make_unique<Data>(&data2_deleted)); EXPECT_TRUE(data1_deleted); EXPECT_FALSE(data2_deleted); ASSERT_EQ(1u, user_data.GetWindows().size()); @@ -70,7 +69,7 @@ aura::Window window(nullptr, aura::client::WINDOW_TYPE_UNKNOWN); window.Init(ui::LAYER_NOT_DRAWN); bool data1_deleted = false; - user_data.Set(&window, base::MakeUnique<Data>(&data1_deleted)); + user_data.Set(&window, std::make_unique<Data>(&data1_deleted)); EXPECT_FALSE(data1_deleted); user_data.Set(&window, nullptr); EXPECT_TRUE(data1_deleted);
diff --git a/ash/wm/ash_focus_rules_unittest.cc b/ash/wm/ash_focus_rules_unittest.cc index ff37b1a..71bd655 100644 --- a/ash/wm/ash_focus_rules_unittest.cc +++ b/ash/wm/ash_focus_rules_unittest.cc
@@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <memory> + #include "ash/public/cpp/shell_window_ids.h" #include "ash/session/session_controller.h" #include "ash/session/test_session_controller_client.h" @@ -11,7 +13,6 @@ #include "ash/wm/lock_state_controller.h" #include "ash/wm/window_state.h" #include "ash/wm/window_util.h" -#include "base/memory/ptr_util.h" #include "services/ui/public/interfaces/window_manager_constants.mojom.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/client/window_parenting_client.h" @@ -90,7 +91,7 @@ void SetUp() override { AshTestBase::SetUp(); ash_test_helper()->set_test_session_controller_client( - base::MakeUnique<LockScreenSessionControllerClient>( + std::make_unique<LockScreenSessionControllerClient>( Shell::Get()->session_controller())); }
diff --git a/ash/wm/drag_window_controller.cc b/ash/wm/drag_window_controller.cc index 773f05f..a5bd33f5 100644 --- a/ash/wm/drag_window_controller.cc +++ b/ash/wm/drag_window_controller.cc
@@ -5,11 +5,11 @@ #include "ash/wm/drag_window_controller.h" #include <algorithm> +#include <memory> #include "ash/public/cpp/shell_window_ids.h" #include "ash/shell.h" #include "ash/wm/window_util.h" -#include "base/memory/ptr_util.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/client/screen_position_client.h" #include "ui/aura/window.h" @@ -189,7 +189,7 @@ if (current.id() == display.id()) continue; drag_windows_.push_back( - base::MakeUnique<DragWindowDetails>(display, window_)); + std::make_unique<DragWindowDetails>(display, window_)); } }
diff --git a/ash/wm/immersive_handler_factory_ash.cc b/ash/wm/immersive_handler_factory_ash.cc index c212e05..d0a5eec 100644 --- a/ash/wm/immersive_handler_factory_ash.cc +++ b/ash/wm/immersive_handler_factory_ash.cc
@@ -4,9 +4,10 @@ #include "ash/wm/immersive_handler_factory_ash.h" +#include <memory> + #include "ash/wm/immersive_focus_watcher_classic.h" #include "ash/wm/immersive_gesture_handler_classic.h" -#include "base/memory/ptr_util.h" namespace ash { @@ -17,13 +18,13 @@ std::unique_ptr<ImmersiveFocusWatcher> ImmersiveHandlerFactoryAsh::CreateFocusWatcher( ImmersiveFullscreenController* controller) { - return base::MakeUnique<ImmersiveFocusWatcherClassic>(controller); + return std::make_unique<ImmersiveFocusWatcherClassic>(controller); } std::unique_ptr<ImmersiveGestureHandler> ImmersiveHandlerFactoryAsh::CreateGestureHandler( ImmersiveFullscreenController* controller) { - return base::MakeUnique<ImmersiveGestureHandlerClassic>(controller); + return std::make_unique<ImmersiveGestureHandlerClassic>(controller); } } // namespace ash
diff --git a/ash/wm/lock_action_handler_layout_manager_unittest.cc b/ash/wm/lock_action_handler_layout_manager_unittest.cc index ca24fe2..ee6db6f 100644 --- a/ash/wm/lock_action_handler_layout_manager_unittest.cc +++ b/ash/wm/lock_action_handler_layout_manager_unittest.cc
@@ -20,6 +20,7 @@ #include "ash/wm/window_state.h" #include "base/command_line.h" #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "services/ui/public/interfaces/window_manager_constants.mojom.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/window.h" @@ -81,7 +82,7 @@ widget_params.show_state = ui::SHOW_STATE_FULLSCREEN; lock_window_ = CreateTestingWindow(widget_params, kShellWindowId_LockScreenContainer, - base::MakeUnique<TestWindowDelegate>()); + std::make_unique<TestWindowDelegate>()); } void TearDown() override { @@ -181,7 +182,7 @@ widget_params.show_state = ui::SHOW_STATE_MAXIMIZED; std::unique_ptr<aura::Window> window = CreateTestingWindow( widget_params, kShellWindowId_LockActionHandlerContainer, - base::MakeUnique<TestWindowDelegate>()); + std::make_unique<TestWindowDelegate>()); // Verify that the window bounds are equal to work area for the bottom shelf // alignment, which matches how the shelf is aligned on the lock screen, @@ -211,7 +212,7 @@ widget_params.show_state = ui::SHOW_STATE_FULLSCREEN; std::unique_ptr<aura::Window> window = CreateTestingWindow( widget_params, kShellWindowId_LockActionHandlerContainer, - base::MakeUnique<TestWindowDelegate>()); + std::make_unique<TestWindowDelegate>()); // Verify that the window bounds are equal to work area for the bottom shelf // alignment, which matches how the shelf is aligned on the lock screen, @@ -235,7 +236,7 @@ views::Widget::InitParams::TYPE_WINDOW); std::unique_ptr<aura::Window> window = CreateTestingWindow( widget_params, kShellWindowId_LockActionHandlerContainer, - base::MakeUnique<TestWindowDelegate>()); + std::make_unique<TestWindowDelegate>()); gfx::Rect target_bounds = display::Screen::GetScreen()->GetPrimaryDisplay().bounds(); @@ -263,7 +264,7 @@ widget_params.show_state = ui::SHOW_STATE_MAXIMIZED; std::unique_ptr<aura::Window> window = CreateTestingWindow( widget_params, kShellWindowId_LockActionHandlerContainer, - base::MakeUnique<TestWindowDelegate>()); + std::make_unique<TestWindowDelegate>()); ASSERT_EQ(initial_bounds.ToString(), window->GetBoundsInScreen().ToString()); ShowKeyboard(true); @@ -422,7 +423,7 @@ widget_params.show_state = ui::SHOW_STATE_FULLSCREEN; std::unique_ptr<aura::Window> window = CreateTestingWindow( widget_params, kShellWindowId_LockActionHandlerContainer, - base::MakeUnique<TestWindowDelegate>()); + std::make_unique<TestWindowDelegate>()); gfx::Rect target_bounds = display::Screen::GetScreen()->GetPrimaryDisplay().bounds();
diff --git a/ash/wm/lock_window_state.cc b/ash/wm/lock_window_state.cc index 52e7f03..d215dff 100644 --- a/ash/wm/lock_window_state.cc +++ b/ash/wm/lock_window_state.cc
@@ -15,7 +15,6 @@ #include "ash/wm/window_state_delegate.h" #include "ash/wm/window_state_util.h" #include "ash/wm/wm_event.h" -#include "base/memory/ptr_util.h" #include "ui/aura/window.h" #include "ui/gfx/geometry/rect.h" #include "ui/keyboard/keyboard_controller.h" @@ -109,7 +108,7 @@ // static wm::WindowState* LockWindowState::SetLockWindowState(aura::Window* window) { std::unique_ptr<wm::WindowState::State> lock_state = - base::MakeUnique<LockWindowState>(window, false); + std::make_unique<LockWindowState>(window, false); wm::WindowState* window_state = wm::GetWindowState(window); std::unique_ptr<wm::WindowState::State> old_state( window_state->SetStateObject(std::move(lock_state))); @@ -120,7 +119,7 @@ wm::WindowState* LockWindowState::SetLockWindowStateWithShelfExcluded( aura::Window* window) { std::unique_ptr<wm::WindowState::State> lock_state = - base::MakeUnique<LockWindowState>(window, true); + std::make_unique<LockWindowState>(window, true); wm::WindowState* window_state = wm::GetWindowState(window); std::unique_ptr<wm::WindowState::State> old_state( window_state->SetStateObject(std::move(lock_state)));
diff --git a/ash/wm/native_cursor_manager_ash_mus.cc b/ash/wm/native_cursor_manager_ash_mus.cc index 9ecf363..469430e 100644 --- a/ash/wm/native_cursor_manager_ash_mus.cc +++ b/ash/wm/native_cursor_manager_ash_mus.cc
@@ -4,6 +4,8 @@ #include "ash/wm/native_cursor_manager_ash_mus.h" +#include <memory> + #include "ash/display/cursor_window_controller.h" #include "ash/display/window_tree_host_manager.h" #include "ash/shell.h" @@ -89,8 +91,8 @@ // CursorFactoryOzone instance. Partially initialize the ozone cursor // internals here, like we partially initialize other ozone subsystems in // ChromeBrowserMainExtraPartsViews. - cursor_factory_ozone_ = base::MakeUnique<ui::CursorDataFactoryOzone>(); - image_cursors_ = base::MakeUnique<ui::ImageCursors>(); + cursor_factory_ozone_ = std::make_unique<ui::CursorDataFactoryOzone>(); + image_cursors_ = std::make_unique<ui::ImageCursors>(); } NativeCursorManagerAshMus::~NativeCursorManagerAshMus() = default;
diff --git a/ash/wm/overview/overview_window_drag_controller.cc b/ash/wm/overview/overview_window_drag_controller.cc index 85c760c..347469e6 100644 --- a/ash/wm/overview/overview_window_drag_controller.cc +++ b/ash/wm/overview/overview_window_drag_controller.cc
@@ -4,6 +4,8 @@ #include "ash/wm/overview/overview_window_drag_controller.h" +#include <memory> + #include "ash/screen_util.h" #include "ash/shell.h" #include "ash/wm/overview/scoped_transform_overview_window.h" @@ -140,7 +142,7 @@ if (!phantom_window_controller_) { phantom_window_controller_ = - base::MakeUnique<PhantomWindowController>(target_window); + std::make_unique<PhantomWindowController>(target_window); } phantom_window_controller_->Show(phantom_bounds_in_screen); }
diff --git a/ash/wm/overview/scoped_transform_overview_window.cc b/ash/wm/overview/scoped_transform_overview_window.cc index 160f18d..886d227b 100644 --- a/ash/wm/overview/scoped_transform_overview_window.cc +++ b/ash/wm/overview/scoped_transform_overview_window.cc
@@ -5,6 +5,7 @@ #include "ash/wm/overview/scoped_transform_overview_window.h" #include <algorithm> +#include <memory> #include <vector> #include "ash/wm/overview/scoped_overview_animation_settings.h" @@ -14,7 +15,6 @@ #include "ash/wm/window_state.h" #include "ash/wm/window_util.h" #include "base/macros.h" -#include "base/memory/ptr_util.h" #include "base/single_thread_task_runner.h" #include "base/threading/thread_task_runner_handle.h" #include "ui/aura/client/aura_constants.h" @@ -202,7 +202,7 @@ ScopedAnimationSettings* animation_settings) { for (auto* window : GetTransientTreeIterator(GetOverviewWindow())) { animation_settings->push_back( - base::MakeUnique<ScopedOverviewAnimationSettings>(animation_type, + std::make_unique<ScopedOverviewAnimationSettings>(animation_type, window)); } } @@ -350,7 +350,7 @@ determined_original_window_shape_ = true; const ShapeRects* window_shape = window()->layer()->alpha_shape(); if (!original_window_shape_ && window_shape) - original_window_shape_ = base::MakeUnique<ShapeRects>(*window_shape); + original_window_shape_ = std::make_unique<ShapeRects>(*window_shape); } gfx::Point target_origin(GetTargetBoundsInScreen().origin()); @@ -383,11 +383,11 @@ std::unique_ptr<ShapeRects> shape; if (original_window_shape_) { // When the |window| has a shape, use the new bounds to clip that shape. - shape = base::MakeUnique<ShapeRects>(*original_window_shape_); + shape = std::make_unique<ShapeRects>(*original_window_shape_); for (auto& rect : *shape) rect.Intersect(bounds); } else { - shape = base::MakeUnique<ShapeRects>(); + shape = std::make_unique<ShapeRects>(); shape->push_back(bounds); } aura::Window* window = GetOverviewWindow(); @@ -398,7 +398,7 @@ void ScopedTransformOverviewWindow::ShowHeader() { ui::Layer* layer = window()->layer(); - layer->SetAlphaShape(original_window_shape_ ? base::MakeUnique<ShapeRects>( + layer->SetAlphaShape(original_window_shape_ ? std::make_unique<ShapeRects>( *original_window_shape_) : nullptr); layer->SetMasksToBounds(false); @@ -528,7 +528,7 @@ params.activatable = views::Widget::InitParams::Activatable::ACTIVATABLE_NO; params.accept_events = true; params.parent = window_->parent(); - minimized_widget_ = base::MakeUnique<views::Widget>(); + minimized_widget_ = std::make_unique<views::Widget>(); minimized_widget_->set_focus_on_creation(false); minimized_widget_->Init(params);
diff --git a/ash/wm/overview/window_grid.cc b/ash/wm/overview/window_grid.cc index 82ea9f65..d860e5d 100644 --- a/ash/wm/overview/window_grid.cc +++ b/ash/wm/overview/window_grid.cc
@@ -6,6 +6,7 @@ #include <algorithm> #include <functional> +#include <memory> #include <set> #include <utility> #include <vector> @@ -23,7 +24,6 @@ #include "ash/wm/window_state.h" #include "base/command_line.h" #include "base/i18n/string_search.h" -#include "base/memory/ptr_util.h" #include "base/strings/string_number_conversions.h" #include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/pathops/SkPathOps.h" @@ -239,7 +239,7 @@ } else { views::View* content_view = new RoundedRectView(border_radius, SK_ColorTRANSPARENT); - content_view->SetBackground(base::MakeUnique<BackgroundWith1PxBorder>( + content_view->SetBackground(std::make_unique<BackgroundWith1PxBorder>( background_color, border_color, border_thickness, border_radius)); widget->SetContentsView(content_view); } @@ -277,7 +277,7 @@ window_observer_.Add(window); window_state_observer_.Add(wm::GetWindowState(window)); window_list_.push_back( - base::MakeUnique<WindowSelectorItem>(window, window_selector_, this)); + std::make_unique<WindowSelectorItem>(window, window_selector_, this)); } }
diff --git a/ash/wm/overview/window_selector.cc b/ash/wm/overview/window_selector.cc index 5824b09..4bb00ed 100644 --- a/ash/wm/overview/window_selector.cc +++ b/ash/wm/overview/window_selector.cc
@@ -6,6 +6,7 @@ #include <algorithm> #include <functional> +#include <memory> #include <set> #include <utility> #include <vector> @@ -270,12 +271,12 @@ void WindowSelector::Init(const WindowList& windows, const WindowList& hide_windows) { hide_overview_windows_ = - base::MakeUnique<ScopedHideOverviewWindows>(std::move(hide_windows)); + std::make_unique<ScopedHideOverviewWindows>(std::move(hide_windows)); if (restore_focus_window_) restore_focus_window_->AddObserver(this); if (SplitViewController::ShouldAllowSplitView()) - split_view_overview_overlay_ = base::MakeUnique<SplitViewOverviewOverlay>(); + split_view_overview_overlay_ = std::make_unique<SplitViewOverviewOverlay>(); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); std::sort(root_windows.begin(), root_windows.end(),
diff --git a/ash/wm/overview/window_selector_unittest.cc b/ash/wm/overview/window_selector_unittest.cc index 6f8f5ec0..308ad29e 100644 --- a/ash/wm/overview/window_selector_unittest.cc +++ b/ash/wm/overview/window_selector_unittest.cc
@@ -3,6 +3,7 @@ // found in the LICENSE file. #include <algorithm> +#include <memory> #include <vector> #include "ash/accessibility/accessibility_delegate.h" @@ -31,6 +32,7 @@ #include "ash/wm/wm_event.h" #include "ash/wm/workspace/workspace_window_resizer.h" #include "base/command_line.h" +#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "base/strings/string_number_conversions.h" #include "base/strings/utf_string_conversions.h"
diff --git a/ash/wm/resize_shadow.cc b/ash/wm/resize_shadow.cc index 5a8e403e..d73829e 100644 --- a/ash/wm/resize_shadow.cc +++ b/ash/wm/resize_shadow.cc
@@ -4,6 +4,8 @@ #include "ash/wm/resize_shadow.h" +#include <memory> + #include "base/lazy_instance.h" #include "base/memory/ptr_util.h" #include "base/time/time.h" @@ -76,7 +78,7 @@ if (!g_shadow_image.Get()) { auto* source = new ResizeShadowImageSource(); - g_shadow_image.Get() = base::MakeUnique<gfx::ImageSkia>( + g_shadow_image.Get() = std::make_unique<gfx::ImageSkia>( base::WrapUnique(source), source->size()); } layer_->UpdateNinePatchLayerImage(*g_shadow_image.Get());
diff --git a/ash/wm/resize_shadow_controller.cc b/ash/wm/resize_shadow_controller.cc index 8177347d2..553559b 100644 --- a/ash/wm/resize_shadow_controller.cc +++ b/ash/wm/resize_shadow_controller.cc
@@ -4,10 +4,10 @@ #include "ash/wm/resize_shadow_controller.h" +#include <memory> #include <utility> #include "ash/wm/resize_shadow.h" -#include "base/memory/ptr_util.h" #include "ui/aura/window.h" namespace ash { @@ -48,7 +48,7 @@ } ResizeShadow* ResizeShadowController::CreateShadow(aura::Window* window) { - auto shadow = base::MakeUnique<ResizeShadow>(window); + auto shadow = std::make_unique<ResizeShadow>(window); window->AddObserver(this); ResizeShadow* raw_shadow = shadow.get();
diff --git a/ash/wm/screen_dimmer.cc b/ash/wm/screen_dimmer.cc index ce3b043a..21efb16 100644 --- a/ash/wm/screen_dimmer.cc +++ b/ash/wm/screen_dimmer.cc
@@ -4,12 +4,13 @@ #include "ash/wm/screen_dimmer.h" +#include <memory> + #include "ash/public/cpp/shell_window_ids.h" #include "ash/shell.h" #include "ash/window_user_data.h" #include "ash/wm/container_finder.h" #include "ash/wm/window_dimmer.h" -#include "base/memory/ptr_util.h" #include "ui/aura/window.h" namespace ash { @@ -27,7 +28,7 @@ : container_(container), is_dimming_(false), at_bottom_(false), - window_dimmers_(base::MakeUnique<WindowUserData<WindowDimmer>>()) { + window_dimmers_(std::make_unique<WindowUserData<WindowDimmer>>()) { Shell::Get()->AddShellObserver(this); } @@ -62,7 +63,7 @@ if (should_dim) { if (!window_dimmer) { window_dimmers_->Set(container, - base::MakeUnique<WindowDimmer>(container)); + std::make_unique<WindowDimmer>(container)); window_dimmer = window_dimmers_->Get(container); window_dimmer->SetDimOpacity(container_ == Container::ROOT ? kDimmingLayerOpacityForRoot
diff --git a/ash/wm/screen_dimmer_unittest.cc b/ash/wm/screen_dimmer_unittest.cc index 4b84a58..0256a879 100644 --- a/ash/wm/screen_dimmer_unittest.cc +++ b/ash/wm/screen_dimmer_unittest.cc
@@ -11,7 +11,6 @@ #include "ash/test/ash_test_base.h" #include "ash/window_user_data.h" #include "ash/wm/window_dimmer.h" -#include "base/memory/ptr_util.h" #include "ui/aura/test/test_windows.h" #include "ui/compositor/layer.h" @@ -24,7 +23,7 @@ void SetUp() override { AshTestBase::SetUp(); - dimmer_ = base::MakeUnique<ScreenDimmer>(ScreenDimmer::Container::ROOT); + dimmer_ = std::make_unique<ScreenDimmer>(ScreenDimmer::Container::ROOT); } void TearDown() override {
diff --git a/ash/wm/screen_pinning_controller.cc b/ash/wm/screen_pinning_controller.cc index 45d8641..cb008822 100644 --- a/ash/wm/screen_pinning_controller.cc +++ b/ash/wm/screen_pinning_controller.cc
@@ -5,6 +5,7 @@ #include "ash/wm/screen_pinning_controller.h" #include <algorithm> +#include <memory> #include <vector> #include "ash/public/cpp/shell_window_ids.h" @@ -15,7 +16,6 @@ #include "ash/wm/window_state.h" #include "base/auto_reset.h" #include "base/logging.h" -#include "base/memory/ptr_util.h" #include "ui/aura/window.h" #include "ui/aura/window_observer.h" #include "ui/wm/core/window_util.h" @@ -142,15 +142,15 @@ }; ScreenPinningController::ScreenPinningController() - : window_dimmers_(base::MakeUnique<WindowUserData<WindowDimmer>>()), + : window_dimmers_(std::make_unique<WindowUserData<WindowDimmer>>()), pinned_container_window_observer_( - base::MakeUnique<PinnedContainerWindowObserver>(this)), + std::make_unique<PinnedContainerWindowObserver>(this)), pinned_container_child_window_observer_( - base::MakeUnique<PinnedContainerChildWindowObserver>(this)), + std::make_unique<PinnedContainerChildWindowObserver>(this)), system_modal_container_window_observer_( - base::MakeUnique<SystemModalContainerWindowObserver>(this)), + std::make_unique<SystemModalContainerWindowObserver>(this)), system_modal_container_child_window_observer_( - base::MakeUnique<SystemModalContainerChildWindowObserver>(this)) { + std::make_unique<SystemModalContainerChildWindowObserver>(this)) { Shell::Get()->window_tree_host_manager()->AddObserver(this); } @@ -262,7 +262,7 @@ aura::Window* ScreenPinningController::CreateWindowDimmer( aura::Window* container) { std::unique_ptr<WindowDimmer> window_dimmer = - base::MakeUnique<WindowDimmer>(container); + std::make_unique<WindowDimmer>(container); window_dimmer->SetDimOpacity(1); // Fully opaque. ::wm::SetWindowFullscreen(window_dimmer->window(), true); window_dimmer->window()->Show();
diff --git a/ash/wm/session_state_animator_impl.cc b/ash/wm/session_state_animator_impl.cc index bbc8f01..fc8cb040 100644 --- a/ash/wm/session_state_animator_impl.cc +++ b/ash/wm/session_state_animator_impl.cc
@@ -4,6 +4,7 @@ #include "ash/wm/session_state_animator_impl.h" +#include <memory> #include <utility> #include <vector> @@ -11,7 +12,6 @@ #include "ash/shell.h" #include "ash/wm/wm_window_animations.h" #include "base/barrier_closure.h" -#include "base/memory/ptr_util.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/window_event_dispatcher.h" #include "ui/compositor/layer_animation_observer.h" @@ -258,9 +258,9 @@ ui::LayerAnimator* animator = window->layer()->GetAnimator(); std::unique_ptr<ui::LayerAnimationSequence> brightness_sequence = - base::MakeUnique<ui::LayerAnimationSequence>(); + std::make_unique<ui::LayerAnimationSequence>(); std::unique_ptr<ui::LayerAnimationSequence> grayscale_sequence = - base::MakeUnique<ui::LayerAnimationSequence>(); + std::make_unique<ui::LayerAnimationSequence>(); std::unique_ptr<ui::LayerAnimationElement> brightness_element = ui::LayerAnimationElement::CreateBrightnessElement(target, duration);
diff --git a/ash/wm/splitview/split_view_controller.cc b/ash/wm/splitview/split_view_controller.cc index e5306fd..f79e95a 100644 --- a/ash/wm/splitview/split_view_controller.cc +++ b/ash/wm/splitview/split_view_controller.cc
@@ -4,6 +4,8 @@ #include "ash/wm/splitview/split_view_controller.h" +#include <memory> + #include "ash/public/cpp/ash_switches.h" #include "ash/public/cpp/shell_window_ids.h" #include "ash/screen_util.h" @@ -89,7 +91,7 @@ divider_position_ = GetDefaultDividerPosition(window); split_view_divider_ = - base::MakeUnique<SplitViewDivider>(this, window->GetRootWindow()); + std::make_unique<SplitViewDivider>(this, window->GetRootWindow()); } State previous_state = state_; @@ -487,7 +489,7 @@ if (!black_scrim_layer_) { // Create an invisible black scrim layer. - black_scrim_layer_ = base::MakeUnique<ui::Layer>(ui::LAYER_SOLID_COLOR); + black_scrim_layer_ = std::make_unique<ui::Layer>(ui::LAYER_SOLID_COLOR); black_scrim_layer_->SetColor(SK_ColorBLACK); GetDefaultSnappedWindow()->GetRootWindow()->layer()->Add( black_scrim_layer_.get());
diff --git a/ash/wm/splitview/split_view_divider.cc b/ash/wm/splitview/split_view_divider.cc index 8a3e751..a2fe344 100644 --- a/ash/wm/splitview/split_view_divider.cc +++ b/ash/wm/splitview/split_view_divider.cc
@@ -4,6 +4,8 @@ #include "ash/wm/splitview/split_view_divider.h" +#include <memory> + #include "ash/ash_constants.h" #include "ash/public/cpp/shell_window_ids.h" #include "ash/shell.h" @@ -171,8 +173,8 @@ aura::Window* always_on_top_container = Shell::GetContainer(root_window, kShellWindowId_AlwaysOnTopContainer); - split_view_window_targeter_ = base::MakeUnique<aura::ScopedWindowTargeter>( - always_on_top_container, base::MakeUnique<AlwaysOnTopWindowTargeter>( + split_view_window_targeter_ = std::make_unique<aura::ScopedWindowTargeter>( + always_on_top_container, std::make_unique<AlwaysOnTopWindowTargeter>( divider_widget_->GetNativeWindow())); } @@ -261,7 +263,7 @@ void SplitViewDivider::CreateDividerWidget(aura::Window* root_window) { DCHECK(!divider_widget_.get()); - divider_widget_ = base::MakeUnique<views::Widget>(); + divider_widget_ = std::make_unique<views::Widget>(); views::Widget::InitParams params(views::Widget::InitParams::TYPE_POPUP); params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; params.opacity = views::Widget::InitParams::OPAQUE_WINDOW;
diff --git a/ash/wm/system_modal_container_layout_manager.cc b/ash/wm/system_modal_container_layout_manager.cc index c536787..a4fc5c7 100644 --- a/ash/wm/system_modal_container_layout_manager.cc +++ b/ash/wm/system_modal_container_layout_manager.cc
@@ -5,6 +5,7 @@ #include "ash/wm/system_modal_container_layout_manager.h" #include <cmath> +#include <memory> #include "ash/public/cpp/config.h" #include "ash/public/cpp/shell_window_ids.h" @@ -13,7 +14,6 @@ #include "ash/shell_port.h" #include "ash/wm/window_dimmer.h" #include "ash/wm/window_util.h" -#include "base/memory/ptr_util.h" #include "base/stl_util.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/window.h" @@ -158,7 +158,7 @@ void SystemModalContainerLayoutManager::CreateModalBackground() { if (!window_dimmer_) { - window_dimmer_ = base::MakeUnique<WindowDimmer>(container_); + window_dimmer_ = std::make_unique<WindowDimmer>(container_); window_dimmer_->window()->SetName( "SystemModalContainerLayoutManager.ModalBackground"); // There isn't always a keyboard controller.
diff --git a/ash/wm/system_modal_container_layout_manager_unittest.cc b/ash/wm/system_modal_container_layout_manager_unittest.cc index b235e866..076be7fb 100644 --- a/ash/wm/system_modal_container_layout_manager_unittest.cc +++ b/ash/wm/system_modal_container_layout_manager_unittest.cc
@@ -16,7 +16,6 @@ #include "ash/wm/window_util.h" #include "base/command_line.h" #include "base/compiler_specific.h" -#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/test/test_window_delegate.h" @@ -813,7 +812,7 @@ // Make sure that a child visibility change should not cause // inconsistent state. - std::unique_ptr<aura::Window> child = base::MakeUnique<aura::Window>(nullptr); + std::unique_ptr<aura::Window> child = std::make_unique<aura::Window>(nullptr); child->SetType(aura::client::WINDOW_TYPE_CONTROL); child->Init(ui::LAYER_TEXTURED); modal_window->AddChild(child.get());
diff --git a/ash/wm/tablet_mode/tablet_mode_controller.cc b/ash/wm/tablet_mode/tablet_mode_controller.cc index 97fa40b..aa36b1e1 100644 --- a/ash/wm/tablet_mode/tablet_mode_controller.cc +++ b/ash/wm/tablet_mode/tablet_mode_controller.cc
@@ -107,7 +107,7 @@ std::unique_ptr<ScopedDisableInternalMouseAndKeyboard> CreateScopedDisableInternalMouseAndKeyboard() { - return base::MakeUnique<ScopedDisableInternalMouseAndKeyboardOzone>(); + return std::make_unique<ScopedDisableInternalMouseAndKeyboardOzone>(); } } // namespace
diff --git a/ash/wm/tablet_mode/tablet_mode_window_manager.cc b/ash/wm/tablet_mode/tablet_mode_window_manager.cc index 9064b67f..a24419f414 100644 --- a/ash/wm/tablet_mode/tablet_mode_window_manager.cc +++ b/ash/wm/tablet_mode/tablet_mode_window_manager.cc
@@ -4,6 +4,8 @@ #include "ash/wm/tablet_mode/tablet_mode_window_manager.h" +#include <memory> + #include "ash/public/cpp/ash_switches.h" #include "ash/public/cpp/shell_window_ids.h" #include "ash/root_window_controller.h" @@ -19,7 +21,6 @@ #include "ash/wm/wm_event.h" #include "ash/wm/workspace_controller.h" #include "base/command_line.h" -#include "base/memory/ptr_util.h" #include "base/stl_util.h" #include "ui/aura/client/aura_constants.h" #include "ui/display/screen.h" @@ -315,7 +316,7 @@ // the topmost window of its container. for (auto* controller : Shell::GetAllRootWindowControllers()) { controller->workspace_controller()->SetBackdropDelegate( - enable ? base::MakeUnique<TabletModeBackdropDelegateImpl>() : nullptr); + enable ? std::make_unique<TabletModeBackdropDelegateImpl>() : nullptr); } }
diff --git a/ash/wm/tablet_mode/touchpad_and_keyboard_disabler.cc b/ash/wm/tablet_mode/touchpad_and_keyboard_disabler.cc index 3758407..6ebab56 100644 --- a/ash/wm/tablet_mode/touchpad_and_keyboard_disabler.cc +++ b/ash/wm/tablet_mode/touchpad_and_keyboard_disabler.cc
@@ -4,6 +4,7 @@ #include "ash/wm/tablet_mode/touchpad_and_keyboard_disabler.h" +#include <memory> #include <utility> #include <vector> @@ -69,7 +70,7 @@ std::unique_ptr<Delegate> delegate) : delegate_(std::move(delegate)), weak_ptr_factory_(this) { if (!delegate_) - delegate_ = base::MakeUnique<DefaultDelegateImpl>(); + delegate_ = std::make_unique<DefaultDelegateImpl>(); Shell::Get()->AddShellObserver(this); delegate_->Disable(base::BindOnce(&TouchpadAndKeyboardDisabler::OnDisableAck, weak_ptr_factory_.GetWeakPtr()));
diff --git a/ash/wm/tablet_mode/touchpad_and_keyboard_disabler_unittest.cc b/ash/wm/tablet_mode/touchpad_and_keyboard_disabler_unittest.cc index caf44d7..f783b9b9 100644 --- a/ash/wm/tablet_mode/touchpad_and_keyboard_disabler_unittest.cc +++ b/ash/wm/tablet_mode/touchpad_and_keyboard_disabler_unittest.cc
@@ -69,7 +69,7 @@ CallCounts* counts, TestDelegate** test_delegate) { std::unique_ptr<TestDelegate> owned_test_delegate = - base::MakeUnique<TestDelegate>( + std::make_unique<TestDelegate>( &(counts->delegate_destroyed), &(counts->hide_cursor_call_count), &(counts->enable_call_count), &(counts->disable_call_count)); *test_delegate = owned_test_delegate.get(); @@ -210,7 +210,7 @@ std::unique_ptr<AshTestEnvironment> ash_test_environment = AshTestEnvironment::Create(); std::unique_ptr<AshTestHelper> ash_test_helper = - base::MakeUnique<AshTestHelper>(ash_test_environment.get()); + std::make_unique<AshTestHelper>(ash_test_environment.get()); const bool start_session = true; ash_test_helper->SetUp(start_session);
diff --git a/ash/wm/window_animations.cc b/ash/wm/window_animations.cc index 3fe859a1..132d6f8 100644 --- a/ash/wm/window_animations.cc +++ b/ash/wm/window_animations.cc
@@ -6,6 +6,7 @@ #include <math.h> #include <algorithm> +#include <memory> #include <utility> #include <vector> @@ -16,7 +17,6 @@ #include "base/i18n/rtl.h" #include "base/lazy_instance.h" #include "base/logging.h" -#include "base/memory/ptr_util.h" #include "base/metrics/histogram_macros.h" #include "base/stl_util.h" #include "base/time/time.h" @@ -116,11 +116,11 @@ float scale_y = static_cast<float>(target_bounds.height()) / bounds.height(); std::unique_ptr<ui::InterpolatedTransform> scale = - base::MakeUnique<ui::InterpolatedScale>( + std::make_unique<ui::InterpolatedScale>( gfx::Point3F(1, 1, 1), gfx::Point3F(scale_x, scale_y, 1)); std::unique_ptr<ui::InterpolatedTransform> translation = - base::MakeUnique<ui::InterpolatedTranslation>( + std::make_unique<ui::InterpolatedTranslation>( gfx::PointF(), gfx::PointF(target_bounds.x() - bounds.x(), target_bounds.y() - bounds.y())); @@ -420,9 +420,9 @@ base::TimeDelta duration) { gfx::Tween::Type animation_type = gfx::Tween::EASE_OUT; std::unique_ptr<ui::LayerAnimationSequence> brightness_sequence = - base::MakeUnique<ui::LayerAnimationSequence>(); + std::make_unique<ui::LayerAnimationSequence>(); std::unique_ptr<ui::LayerAnimationSequence> grayscale_sequence = - base::MakeUnique<ui::LayerAnimationSequence>(); + std::make_unique<ui::LayerAnimationSequence>(); std::unique_ptr<ui::LayerAnimationElement> brightness_element = ui::LayerAnimationElement::CreateBrightnessElement(target_value,
diff --git a/ash/wm/window_cycle_list.cc b/ash/wm/window_cycle_list.cc index 7cc7a168..80b3fc04 100644 --- a/ash/wm/window_cycle_list.cc +++ b/ash/wm/window_cycle_list.cc
@@ -6,6 +6,7 @@ #include <list> #include <map> +#include <memory> #include "ash/public/cpp/shell_window_ids.h" #include "ash/shell.h" @@ -14,7 +15,6 @@ #include "ash/wm/window_state.h" #include "ash/wm/window_util.h" #include "base/command_line.h" -#include "base/memory/ptr_util.h" #include "ui/accessibility/ax_node_data.h" #include "ui/compositor/scoped_layer_animation_settings.h" #include "ui/display/display.h" @@ -247,7 +247,7 @@ // The background needs to be painted to fill the layer, not the View, // because the layer animates bounds changes but the View's bounds change // immediately. - highlight_view_->SetBackground(base::MakeUnique<LayerFillBackgroundPainter>( + highlight_view_->SetBackground(std::make_unique<LayerFillBackgroundPainter>( views::Painter::CreateRoundRectWith1PxBorderPainter( SkColorSetA(SK_ColorWHITE, 0x4D), SkColorSetA(SK_ColorWHITE, 0x33), kBackgroundCornerRadius)));
diff --git a/ash/wm/window_state.cc b/ash/wm/window_state.cc index eff20fb..7b08728 100644 --- a/ash/wm/window_state.cc +++ b/ash/wm/window_state.cc
@@ -4,6 +4,7 @@ #include "ash/wm/window_state.h" +#include <memory> #include <utility> #include "ash/public/cpp/window_properties.h" @@ -20,7 +21,6 @@ #include "ash/wm/window_util.h" #include "ash/wm/wm_event.h" #include "base/auto_reset.h" -#include "base/memory/ptr_util.h" #include "services/ui/public/interfaces/window_manager_constants.mojom.h" #include "ui/aura/client/aura_constants.h" #include "ui/aura/layout_manager.h" @@ -340,7 +340,7 @@ void WindowState::CreateDragDetails(const gfx::Point& point_in_parent, int window_component, ::wm::WindowMoveSource source) { - drag_details_ = base::MakeUnique<DragDetails>(window_, point_in_parent, + drag_details_ = std::make_unique<DragDetails>(window_, point_in_parent, window_component, source); }
diff --git a/ash/wm/window_util.cc b/ash/wm/window_util.cc index 3d6edb7..f0709f8 100644 --- a/ash/wm/window_util.cc +++ b/ash/wm/window_util.cc
@@ -4,6 +4,7 @@ #include "ash/wm/window_util.h" +#include <memory> #include <vector> #include "ash/ash_constants.h" @@ -174,7 +175,7 @@ // frame. Mus needs to support an api for the WindowManager that enables // events to be dispatched to windows outside the windows bounds that this // function calls into. http://crbug.com/679056. - window->SetEventTargeter(base::MakeUnique<::wm::EasyResizeWindowTargeter>( + window->SetEventTargeter(std::make_unique<::wm::EasyResizeWindowTargeter>( window, mouse_extend, touch_extend)); } @@ -211,7 +212,7 @@ void InstallResizeHandleWindowTargeterForWindow( aura::Window* window, ImmersiveFullscreenController* immersive_fullscreen_controller) { - window->SetEventTargeter(base::MakeUnique<ResizeHandleWindowTargeter>( + window->SetEventTargeter(std::make_unique<ResizeHandleWindowTargeter>( window, immersive_fullscreen_controller)); }
diff --git a/ash/wm/workspace/backdrop_controller.cc b/ash/wm/workspace/backdrop_controller.cc index 48ef572d3..91efc4f9 100644 --- a/ash/wm/workspace/backdrop_controller.cc +++ b/ash/wm/workspace/backdrop_controller.cc
@@ -4,6 +4,8 @@ #include "ash/wm/workspace/backdrop_controller.h" +#include <memory> + #include "ash/accessibility/accessibility_delegate.h" #include "ash/public/cpp/app_types.h" #include "ash/public/cpp/shell_window_ids.h" @@ -12,7 +14,6 @@ #include "ash/wm/window_util.h" #include "ash/wm/workspace/backdrop_delegate.h" #include "base/auto_reset.h" -#include "base/memory/ptr_util.h" #include "chromeos/audio/chromeos_sounds.h" #include "ui/app_list/app_list_features.h" #include "ui/aura/client/aura_constants.h" @@ -196,7 +197,7 @@ Shell::Get()->accessibility_delegate()->IsSpokenFeedbackEnabled(); if (enabled) { if (!backdrop_event_handler_) { - backdrop_event_handler_ = base::MakeUnique<BackdropEventHandler>(); + backdrop_event_handler_ = std::make_unique<BackdropEventHandler>(); original_event_handler_ = backdrop_window_->SetTargetHandler(backdrop_event_handler_.get()); }
diff --git a/ash/wm/workspace/magnetism_matcher.cc b/ash/wm/workspace/magnetism_matcher.cc index d7870ff..edb44e05 100644 --- a/ash/wm/workspace/magnetism_matcher.cc +++ b/ash/wm/workspace/magnetism_matcher.cc
@@ -6,8 +6,7 @@ #include <algorithm> #include <cmath> - -#include "base/memory/ptr_util.h" +#include <memory> namespace ash { namespace { @@ -123,19 +122,19 @@ : edges_(edges) { if (edges & MAGNETISM_EDGE_TOP) { matchers_.push_back( - base::MakeUnique<MagnetismEdgeMatcher>(bounds, MAGNETISM_EDGE_TOP)); + std::make_unique<MagnetismEdgeMatcher>(bounds, MAGNETISM_EDGE_TOP)); } if (edges & MAGNETISM_EDGE_LEFT) { matchers_.push_back( - base::MakeUnique<MagnetismEdgeMatcher>(bounds, MAGNETISM_EDGE_LEFT)); + std::make_unique<MagnetismEdgeMatcher>(bounds, MAGNETISM_EDGE_LEFT)); } if (edges & MAGNETISM_EDGE_BOTTOM) { matchers_.push_back( - base::MakeUnique<MagnetismEdgeMatcher>(bounds, MAGNETISM_EDGE_BOTTOM)); + std::make_unique<MagnetismEdgeMatcher>(bounds, MAGNETISM_EDGE_BOTTOM)); } if (edges & MAGNETISM_EDGE_RIGHT) { matchers_.push_back( - base::MakeUnique<MagnetismEdgeMatcher>(bounds, MAGNETISM_EDGE_RIGHT)); + std::make_unique<MagnetismEdgeMatcher>(bounds, MAGNETISM_EDGE_RIGHT)); } }
diff --git a/ash/wm/workspace/workspace_layout_manager.cc b/ash/wm/workspace/workspace_layout_manager.cc index 74a4255..72904cd 100644 --- a/ash/wm/workspace/workspace_layout_manager.cc +++ b/ash/wm/workspace/workspace_layout_manager.cc
@@ -5,6 +5,7 @@ #include "ash/wm/workspace/workspace_layout_manager.h" #include <algorithm> +#include <memory> #include "ash/keyboard/keyboard_observer_register.h" #include "ash/public/cpp/shell_window_ids.h" @@ -49,7 +50,7 @@ root_window_->AddObserver(this); display::Screen::GetScreen()->AddObserver(this); DCHECK(window->GetProperty(kSnapChildrenToPixelBoundary)); - backdrop_controller_ = base::MakeUnique<BackdropController>(window_); + backdrop_controller_ = std::make_unique<BackdropController>(window_); } WorkspaceLayoutManager::~WorkspaceLayoutManager() {
diff --git a/ash/wm/workspace/workspace_layout_manager_unittest.cc b/ash/wm/workspace/workspace_layout_manager_unittest.cc index 1ebe868..d4e881d 100644 --- a/ash/wm/workspace/workspace_layout_manager_unittest.cc +++ b/ash/wm/workspace/workspace_layout_manager_unittest.cc
@@ -121,7 +121,7 @@ void EnableStickyKeyboard() { keyboard::KeyboardController::ResetInstance(new keyboard::KeyboardController( - base::MakeUnique<keyboard::FakeKeyboardUI>(), nullptr)); + std::make_unique<keyboard::FakeKeyboardUI>(), nullptr)); keyboard::KeyboardController::GetInstance()->set_keyboard_locked(true); } @@ -389,7 +389,7 @@ // doesn't effect the restore bounds. TEST_F(WorkspaceLayoutManagerTest, DontClobberRestoreBounds) { DontClobberRestoreBoundsWindowObserver window_observer; - std::unique_ptr<aura::Window> window(base::MakeUnique<aura::Window>( + std::unique_ptr<aura::Window> window(std::make_unique<aura::Window>( nullptr, aura::client::WINDOW_TYPE_NORMAL)); window->Init(ui::LAYER_TEXTURED); window->SetBounds(gfx::Rect(10, 20, 30, 40)); @@ -429,7 +429,7 @@ // Verifies a window created with maximized state has the maximized // bounds. TEST_F(WorkspaceLayoutManagerTest, MaximizeWithEmptySize) { - std::unique_ptr<aura::Window> window(base::MakeUnique<aura::Window>( + std::unique_ptr<aura::Window> window(std::make_unique<aura::Window>( nullptr, aura::client::WINDOW_TYPE_NORMAL)); window->Init(ui::LAYER_TEXTURED); wm::GetWindowState(window.get())->Maximize(); @@ -612,7 +612,7 @@ TEST_F(WorkspaceLayoutManagerTest, DoNotAdjustTransientWindowBoundsToEnsureMinimumVisibility) { UpdateDisplay("300x400"); - std::unique_ptr<aura::Window> window(base::MakeUnique<aura::Window>( + std::unique_ptr<aura::Window> window(std::make_unique<aura::Window>( nullptr, aura::client::WINDOW_TYPE_NORMAL)); window->Init(ui::LAYER_TEXTURED); window->SetBounds(gfx::Rect(10, 0, 100, 200)); @@ -997,7 +997,7 @@ void ShowTopWindowBackdropForContainer(aura::Window* container, bool show) { std::unique_ptr<BackdropDelegate> backdrop; if (show) { - backdrop = base::MakeUnique<TabletModeBackdropDelegateImpl>(); + backdrop = std::make_unique<TabletModeBackdropDelegateImpl>(); } GetWorkspaceLayoutManager(container)->SetBackdropDelegate( std::move(backdrop));
diff --git a/ash/wm/workspace/workspace_window_resizer.cc b/ash/wm/workspace/workspace_window_resizer.cc index 80d3b21..4a11a7bc 100644 --- a/ash/wm/workspace/workspace_window_resizer.cc +++ b/ash/wm/workspace/workspace_window_resizer.cc
@@ -6,6 +6,7 @@ #include <algorithm> #include <cmath> +#include <memory> #include <utility> #include <vector> @@ -21,7 +22,6 @@ #include "ash/wm/wm_event.h" #include "ash/wm/workspace/phantom_window_controller.h" #include "ash/wm/workspace/two_step_edge_cycler.h" -#include "base/memory/ptr_util.h" #include "base/memory/weak_ptr.h" #include "base/metrics/user_metrics.h" #include "ui/aura/client/window_types.h" @@ -895,7 +895,7 @@ if (!snap_phantom_window_controller_) { snap_phantom_window_controller_ = - base::MakeUnique<PhantomWindowController>(GetTarget()); + std::make_unique<PhantomWindowController>(GetTarget()); } gfx::Rect phantom_bounds_in_screen(phantom_bounds); ::wm::ConvertRectToScreen(GetTarget()->parent(), &phantom_bounds_in_screen);
diff --git a/chrome/browser/chromeos/display/display_configuration_observer.cc b/chrome/browser/chromeos/display/display_configuration_observer.cc index e100174..9c7b80aa 100644 --- a/chrome/browser/chromeos/display/display_configuration_observer.cc +++ b/chrome/browser/chromeos/display/display_configuration_observer.cc
@@ -6,9 +6,12 @@ #include "ash/display/window_tree_host_manager.h" #include "ash/shell.h" +#include "ash/wm/tablet_mode/tablet_mode_controller.h" #include "base/command_line.h" #include "chrome/browser/chromeos/display/display_preferences.h" #include "chromeos/chromeos_switches.h" +#include "ui/display/manager/display_layout_store.h" +#include "ui/display/manager/display_manager.h" namespace chromeos { @@ -17,18 +20,45 @@ } DisplayConfigurationObserver::~DisplayConfigurationObserver() { + ash::Shell::Get()->tablet_mode_controller()->RemoveObserver(this); ash::Shell::Get()->window_tree_host_manager()->RemoveObserver(this); } void DisplayConfigurationObserver::OnDisplaysInitialized() { + ash::Shell::Get()->tablet_mode_controller()->AddObserver(this); // Update the display pref with the initial power state. base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); - if (command_line->HasSwitch(chromeos::switches::kFirstExecAfterBoot)) + if (command_line->HasSwitch(chromeos::switches::kFirstExecAfterBoot) && + save_preference_) { StoreDisplayPrefs(); + } } void DisplayConfigurationObserver::OnDisplayConfigurationChanged() { - StoreDisplayPrefs(); + if (save_preference_) + StoreDisplayPrefs(); +} + +void DisplayConfigurationObserver::OnTabletModeStarted() { + // TODO(oshima): Tablet mode defaults to mirror mode until we figure out + // how to handle this scenario, and we shouldn't save this state. + // crbug.com/733092. + save_preference_ = false; + // TODO(oshima): Mirroring won't work with 3 displays. crbug.com/737667. + display::DisplayManager* display_manager = + ash::Shell::Get()->display_manager(); + was_in_mirror_mode_ = display_manager->IsInMirrorMode(); + display_manager->SetMirrorMode(true); + display_manager->layout_store()->set_forced_mirror_mode(true); +} + +void DisplayConfigurationObserver::OnTabletModeEnded() { + if (!was_in_mirror_mode_) + ash::Shell::Get()->display_manager()->SetMirrorMode(false); + display::DisplayManager* display_manager = + ash::Shell::Get()->display_manager(); + display_manager->layout_store()->set_forced_mirror_mode(false); + save_preference_ = true; } } // namespace chromeos
diff --git a/chrome/browser/chromeos/display/display_configuration_observer.h b/chrome/browser/chromeos/display/display_configuration_observer.h index 709dfe9..f1c0c2f2e 100644 --- a/chrome/browser/chromeos/display/display_configuration_observer.h +++ b/chrome/browser/chromeos/display/display_configuration_observer.h
@@ -6,6 +6,7 @@ #define CHROME_BROWSER_CHROMEOS_DISPLAY_DISPLAY_CONFIGURATION_OBSERVER_H_ #include "ash/display/window_tree_host_manager.h" +#include "ash/wm/tablet_mode/tablet_mode_observer.h" #include "base/compiler_specific.h" #include "base/macros.h" @@ -14,16 +15,27 @@ // DisplayConfigurationObserver observes and saves // the change of display configurations. class DisplayConfigurationObserver - : public ash::WindowTreeHostManager::Observer { + : public ash::WindowTreeHostManager::Observer, + public ash::TabletModeObserver { public: DisplayConfigurationObserver(); ~DisplayConfigurationObserver() override; protected: - // ash::WindowTreeHostManager::Observer overrides: + // ash::WindowTreeHostManager::Observer: void OnDisplaysInitialized() override; void OnDisplayConfigurationChanged() override; + // ash::TabletModeObserver: + void OnTabletModeStarted() override; + void OnTabletModeEnded() override; + + bool save_preference_ = true; + + // True if the device was in mirror mode before siwtching to + // tablet mode. + bool was_in_mirror_mode_ = false; + DISALLOW_COPY_AND_ASSIGN(DisplayConfigurationObserver); };
diff --git a/chrome/browser/chromeos/display/display_preferences_unittest.cc b/chrome/browser/chromeos/display/display_preferences_unittest.cc index a846394..531f66a 100644 --- a/chrome/browser/chromeos/display/display_preferences_unittest.cc +++ b/chrome/browser/chromeos/display/display_preferences_unittest.cc
@@ -78,7 +78,8 @@ ash::AshTestBase::SetUp(); RegisterDisplayLocalStatePrefs(local_state_.registry()); TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); - observer_.reset(new DisplayConfigurationObserver()); + observer_ = std::make_unique<DisplayConfigurationObserver>(); + observer_->OnDisplaysInitialized(); } void TearDown() override { @@ -120,29 +121,41 @@ base::DictionaryValue* pref_data = update.Get(); std::unique_ptr<base::Value> layout_value(new base::DictionaryValue()); - if (pref_data->HasKey(name)) { - base::Value* value = nullptr; - if (pref_data->Get(name, &value) && value != nullptr) - layout_value.reset(value->DeepCopy()); - } + base::Value* value = nullptr; + if (pref_data->Get(name, &value) && value != nullptr) + layout_value.reset(value->DeepCopy()); if (display::DisplayLayoutToJson(display_layout, layout_value.get())) pref_data->Set(name, std::move(layout_value)); } + bool GetDisplayPropertyFromList(const display::DisplayIdList& list, + const std::string& key, + base::Value** out_value) { + std::string name = display::DisplayIdListToString(list); + + DictionaryPrefUpdate update(&local_state_, prefs::kSecondaryDisplays); + base::DictionaryValue* pref_data = update.Get(); + + base::Value* layout_value = pref_data->FindPath({name}); + if (layout_value) { + return static_cast<base::DictionaryValue*>(layout_value) + ->Get(key, out_value); + } + return false; + } + void StoreDisplayPropertyForList(const display::DisplayIdList& list, - std::string key, + const std::string& key, std::unique_ptr<base::Value> value) { std::string name = display::DisplayIdListToString(list); DictionaryPrefUpdate update(&local_state_, prefs::kSecondaryDisplays); base::DictionaryValue* pref_data = update.Get(); - if (pref_data->HasKey(name)) { - base::Value* layout_value = nullptr; - pref_data->Get(name, &layout_value); - if (layout_value) - static_cast<base::DictionaryValue*>(layout_value) - ->Set(key, std::move(value)); + base::Value* layout_value = pref_data->FindPath({name}); + if (layout_value) { + static_cast<base::DictionaryValue*>(layout_value) + ->Set(key, std::move(value)); } else { std::unique_ptr<base::DictionaryValue> layout_value( new base::DictionaryValue()); @@ -201,7 +214,7 @@ MockUserManager* mock_user_manager_; // Not owned. ScopedUserManagerEnabler user_manager_enabler_; TestingPrefServiceSimple local_state_; - std::unique_ptr<DisplayConfigurationObserver> observer_; + std::unique_ptr<ash::WindowTreeHostManager::Observer> observer_; DISALLOW_COPY_AND_ASSIGN(DisplayPreferencesTest); }; @@ -1138,4 +1151,50 @@ display_manager()->GetDisplayForId(list[2]).bounds()); } +TEST_F(DisplayPreferencesTest, MirrorWhenEnterTableMode) { + display::Display::SetInternalDisplayId( + display::Screen::GetScreen()->GetPrimaryDisplay().id()); + LoggedInAsUser(); + UpdateDisplay("800x600,1200x800"); + EXPECT_FALSE(display_manager()->IsInMirrorMode()); + ash::TabletModeController* controller = + ash::Shell::Get()->tablet_mode_controller(); + controller->EnableTabletModeWindowManager(true); + ASSERT_TRUE(controller->IsTabletModeWindowManagerEnabled()); + EXPECT_TRUE(display_manager()->IsInMirrorMode()); + + // Make sure the mirror mode is not saved in the preference. + display::DisplayIdList list = display_manager()->GetCurrentDisplayIdList(); + ASSERT_EQ(2u, list.size()); + base::Value* value; + EXPECT_TRUE(GetDisplayPropertyFromList(list, "mirrored", &value)); + bool mirrored; + EXPECT_TRUE(value->GetAsBoolean(&mirrored)); + EXPECT_FALSE(mirrored); + + // Exiting the tablet mode should exit mirror mode. + controller->EnableTabletModeWindowManager(false); + ASSERT_FALSE(controller->IsTabletModeWindowManagerEnabled()); + EXPECT_FALSE(display_manager()->IsInMirrorMode()); +} + +TEST_F(DisplayPreferencesTest, AlreadyMirrorWhenEnterTableMode) { + display::Display::SetInternalDisplayId( + display::Screen::GetScreen()->GetPrimaryDisplay().id()); + LoggedInAsUser(); + UpdateDisplay("800x600,1200x800"); + display_manager()->SetMirrorMode(true); + EXPECT_TRUE(display_manager()->IsInMirrorMode()); + ash::TabletModeController* controller = + ash::Shell::Get()->tablet_mode_controller(); + controller->EnableTabletModeWindowManager(true); + ASSERT_TRUE(controller->IsTabletModeWindowManagerEnabled()); + EXPECT_TRUE(display_manager()->IsInMirrorMode()); + + // Exiting the tablet mode should stay in mirror mode. + controller->EnableTabletModeWindowManager(false); + ASSERT_FALSE(controller->IsTabletModeWindowManagerEnabled()); + EXPECT_TRUE(display_manager()->IsInMirrorMode()); +} + } // namespace chromeos
diff --git a/chrome/browser/media/webrtc/webrtc_apprtc_browsertest.cc b/chrome/browser/media/webrtc/webrtc_apprtc_browsertest.cc index 7ae0618..0bf1810 100644 --- a/chrome/browser/media/webrtc/webrtc_apprtc_browsertest.cc +++ b/chrome/browser/media/webrtc/webrtc_apprtc_browsertest.cc
@@ -291,9 +291,7 @@ } #if defined(OS_LINUX) -// Disabled due to failure, see http://crbug.com/751211. -#define MAYBE_MANUAL_FirefoxApprtcInteropTest \ - DISABLED_MANUAL_FirefoxApprtcInteropTest +#define MAYBE_MANUAL_FirefoxApprtcInteropTest MANUAL_FirefoxApprtcInteropTest #else // Not implemented yet on Windows and Mac. #define MAYBE_MANUAL_FirefoxApprtcInteropTest \ @@ -302,6 +300,7 @@ IN_PROC_BROWSER_TEST_F(WebRtcApprtcBrowserTest, MAYBE_MANUAL_FirefoxApprtcInteropTest) { + base::ScopedAllowBlockingForTesting allow_blocking; DetectErrorsInJavaScript(); ASSERT_TRUE(LaunchApprtcInstanceOnLocalhost("9999")); ASSERT_TRUE(LaunchColliderOnLocalHost("http://localhost:9999", "8089"));
diff --git a/chrome/browser/resource_coordinator/tab_manager_browsertest.cc b/chrome/browser/resource_coordinator/tab_manager_browsertest.cc index fd0cda76..764b46d7 100644 --- a/chrome/browser/resource_coordinator/tab_manager_browsertest.cc +++ b/chrome/browser/resource_coordinator/tab_manager_browsertest.cc
@@ -826,8 +826,16 @@ } // namespace +// Flaky on Linux. http://crbug.com/772839. +#if defined(OS_LINUX) +#define MAYBE_DiscardTabsWithMinimizedAndOccludedWindows \ + DISABLED_DiscardTabsWithMinimizedAndOccludedWindows +#else +#define MAYBE_DiscardTabsWithMinimizedAndOccludedWindows \ + DiscardTabsWithMinimizedAndOccludedWindows +#endif IN_PROC_BROWSER_TEST_F(TabManagerTest, - DiscardTabsWithMinimizedAndOccludedWindows) { + MAYBE_DiscardTabsWithMinimizedAndOccludedWindows) { TabManager* tab_manager = g_browser_process->GetTabManager(); // Disable the protection of recent tabs.
diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel_test.extjs b/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel_test.extjs index b538aa38..ddde7dbe 100644 --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel_test.extjs +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/panel_test.extjs
@@ -65,6 +65,7 @@ */} }; +// Flaky. http://crbug.com/751046. TEST_F('PanelTest', 'DISABLED_ActivateMenu', function() { var mockFeedback = this.createMockFeedback(); this.runWithLoadedTree(this.linksDoc, function(root) { @@ -81,6 +82,7 @@ }); }); +// Flaky. http://crbug.com/751046. TEST_F('PanelTest', 'DISABLED_LinkMenu', function() { var mockFeedback = this.createMockFeedback(); this.runWithLoadedTree(this.linksDoc, function(root) {
diff --git a/chrome/browser/ui/views/passwords/manage_password_items_view.cc b/chrome/browser/ui/views/passwords/manage_password_items_view.cc index 83d2fbb..24c8b44 100644 --- a/chrome/browser/ui/views/passwords/manage_password_items_view.cc +++ b/chrome/browser/ui/views/passwords/manage_password_items_view.cc
@@ -127,6 +127,8 @@ const autofill::PasswordForm& form) { auto editable = base::MakeUnique<views::Textfield>(); editable->SetText(form.username_value); + editable->SetAccessibleName( + l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_USERNAME_LABEL)); return editable; } @@ -144,6 +146,7 @@ label->SetHorizontalAlignment(gfx::ALIGN_LEFT); if (form.federation_origin.unique() && !is_password_visible) label->SetObscured(true); + label->SetFocusBehavior(views::View::FocusBehavior::ACCESSIBLE_ONLY); return label; }
diff --git a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc index 0fab492..e4461b8 100644 --- a/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc +++ b/chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc
@@ -258,6 +258,8 @@ } else { combobox->SetSelectedIndex(index); } + combobox->SetAccessibleName( + l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_PASSWORD_LABEL)); return combobox; }
diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc index 5ec0e28..aab5f4d 100644 --- a/content/browser/frame_host/navigation_request.cc +++ b/content/browser/frame_host/navigation_request.cc
@@ -428,11 +428,21 @@ state_ = STARTED; #if defined(OS_ANDROID) - if (GetContentClient()->browser()->ShouldOverrideUrlLoading( + base::WeakPtr<NavigationRequest> this_ptr(weak_factory_.GetWeakPtr()); + bool should_override_url_loading = + GetContentClient()->browser()->ShouldOverrideUrlLoading( frame_tree_node_->frame_tree_node_id(), browser_initiated_, request_params_.original_url, request_params_.original_method, request_params_.has_user_gesture, false, - frame_tree_node_->IsMainFrame(), common_params_.transition)) { + frame_tree_node_->IsMainFrame(), common_params_.transition); + + // The content/ embedder might cause |this| to be deleted while + // |ShouldOverrideUrlLoading| is called. + // See https://crbug.com/770157. + if (!this_ptr) + return; + + if (should_override_url_loading) { // Don't create a NavigationHandle here to simulate what happened with the // old navigation code path (i.e. doesn't fire onPageFinished notification // for aborted loads). @@ -677,13 +687,24 @@ // |this| may be deleted. #if defined(OS_ANDROID) - if (this_ptr && + if (!this_ptr) + return; + + bool should_override_url_loading = GetContentClient()->browser()->ShouldOverrideUrlLoading( frame_tree_node_->frame_tree_node_id(), browser_initiated_, redirect_info.new_url, redirect_info.new_method, // Redirects are always not counted as from user gesture. false, true, frame_tree_node_->IsMainFrame(), - common_params_.transition)) { + common_params_.transition); + + // The content/ embedder might cause |this| to be deleted while + // |ShouldOverrideUrlLoading| is called. + // See https://crbug.com/770157. + if (!this_ptr) + return; + + if (should_override_url_loading) { navigation_handle_->set_net_error_code(net::ERR_ABORTED); frame_tree_node_->ResetNavigationRequest(false, true); return;
diff --git a/content/browser/frame_host/navigation_request.h b/content/browser/frame_host/navigation_request.h index f2ee387..450142c 100644 --- a/content/browser/frame_host/navigation_request.h +++ b/content/browser/frame_host/navigation_request.h
@@ -104,6 +104,7 @@ ~NavigationRequest() override; // Called on the UI thread by the Navigator to start the navigation. + // The NavigationRequest can be deleted while BeginNavigation() is called. void BeginNavigation(); const CommonNavigationParams& common_params() const { return common_params_; }
diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc index 3cd94fca..7ddc355 100644 --- a/content/browser/frame_host/navigator_impl.cc +++ b/content/browser/frame_host/navigator_impl.cc
@@ -975,6 +975,9 @@ // Send the request to the IO thread. navigation_request->BeginNavigation(); + // DO NOT USE |navigation_request| BEYOND THIS POINT. It might have been + // destroyed in BeginNavigation(). + // See https://crbug.com/770157. } // PlzNavigate @@ -1044,6 +1047,9 @@ // |DidStartMainFrameNavigation|, so it receives the most up to date pending // entry from the NavigationController. navigation_request->BeginNavigation(); + // DO NOT USE |navigation_request| BEYOND THIS POINT. It might have been + // destroyed in BeginNavigation(). + // See https://crbug.com/770157. } void NavigatorImpl::OnAbortNavigation(FrameTreeNode* frame_tree_node) { @@ -1208,6 +1214,10 @@ true, reload_type != ReloadType::NONE); } else { navigation_request->BeginNavigation(); + // DO NOT USE |navigation_request| BEYOND THIS POINT. It might have been + // destroyed in BeginNavigation(). + // See https://crbug.com/770157. + return; } }
diff --git a/device/bluetooth/public/interfaces/BUILD.gn b/device/bluetooth/public/interfaces/BUILD.gn index ff119ab6..0d2867d 100644 --- a/device/bluetooth/public/interfaces/BUILD.gn +++ b/device/bluetooth/public/interfaces/BUILD.gn
@@ -10,7 +10,7 @@ ] # TODO(crbug.com/699569): Convert to use the new JS bindings. - js_bindings_mode = "both" + use_new_js_bindings = false } mojom("fake_bluetooth_interfaces") { @@ -23,6 +23,9 @@ ] use_once_callback = true + + # TODO(crbug.com/699569): Convert to use the new JS bindings. + use_new_js_bindings = false } mojom("experimental_interfaces") {
diff --git a/ios/chrome/app/application_delegate/app_state_unittest.mm b/ios/chrome/app/application_delegate/app_state_unittest.mm index 29b62be..5d81095 100644 --- a/ios/chrome/app/application_delegate/app_state_unittest.mm +++ b/ios/chrome/app/application_delegate/app_state_unittest.mm
@@ -449,8 +449,10 @@ EXPECT_OCMOCK_VERIFY(browserLauncherMock); } +using AppStateNoFixtureTest = PlatformTest; + // Test that -willResignActive set cold start to NO and launch record. -TEST(AppStateNoFixtureTest, willResignActive) { +TEST_F(AppStateNoFixtureTest, willResignActive) { // Setup. id tabModel = [OCMockObject mockForClass:[TabModel class]]; [[tabModel expect] recordSessionMetrics];
diff --git a/ios/chrome/app/application_delegate/background_activity_unittest.mm b/ios/chrome/app/application_delegate/background_activity_unittest.mm index 2c6a5d3..89e3be4 100644 --- a/ios/chrome/app/application_delegate/background_activity_unittest.mm +++ b/ios/chrome/app/application_delegate/background_activity_unittest.mm
@@ -18,9 +18,11 @@ #error "This file requires ARC support." #endif +using BackgroundActivityTest = PlatformTest; + // Verifies that -application:performFetchWithCompletionHandler: calls the // browser launcher in background state and uploads the report. -TEST(BackgroundActivityTest, performFetchWithCompletionHandler) { +TEST_F(BackgroundActivityTest, performFetchWithCompletionHandler) { // Setup. [[PreviousSessionInfo sharedInstance] setIsFirstSessionAfterUpgrade:NO]; @@ -58,7 +60,7 @@ // Verifies that -handleEventsForBackgroundURLSession:completionHandler: calls // the browser launcher in background state. -TEST(BackgroundActivityTest, handleEventsForBackgroundURLSession) { +TEST_F(BackgroundActivityTest, handleEventsForBackgroundURLSession) { // Setup. // BrowserLauncher mock. id browser_launcher =
diff --git a/ios/chrome/app/application_delegate/metrics_mediator_unittest.mm b/ios/chrome/app/application_delegate/metrics_mediator_unittest.mm index a010802..b4235728 100644 --- a/ios/chrome/app/application_delegate/metrics_mediator_unittest.mm +++ b/ios/chrome/app/application_delegate/metrics_mediator_unittest.mm
@@ -92,9 +92,11 @@ return 1; } +using MetricsMediatorTest = PlatformTest; + // Verifies that connectionTypeChanged correctly enables or disables the // uploading in the breakpad and in the metrics service. -TEST(MetricsMediatorTest, connectionTypeChanged) { +TEST_F(MetricsMediatorTest, connectionTypeChanged) { [[PreviousSessionInfo sharedInstance] setIsFirstSessionAfterUpgrade:NO]; MetricsMediatorMock* mock_metrics_helper = [[MetricsMediatorMock alloc] init]; @@ -216,8 +218,10 @@ verifySwizzleHasBeenCalled(); } +using MetricsMediatorNoFixtureTest = PlatformTest; + // Tests that +logDateInUserDefaults logs the date in UserDefaults. -TEST(MetricsMediatorNoFixtureTest, logDateInUserDefaultsTest) { +TEST_F(MetricsMediatorNoFixtureTest, logDateInUserDefaultsTest) { // Setup. [[NSUserDefaults standardUserDefaults] removeObjectForKey:metrics_mediator::kAppEnteredBackgroundDateKey]; @@ -238,7 +242,9 @@ #pragma mark - processCrashReportsPresentAtStartup tests. -class MetricsMediatorShutdownTypeTest : public testing::TestWithParam<int> {}; +class MetricsMediatorShutdownTypeTest + : public PlatformTest, + public testing::WithParamInterface<int> {}; // Verifies that the Breakpad controller gets called appropriately when // processCrashReportsPresentAtStartup is invoked.
diff --git a/ios/chrome/app/application_delegate/user_activity_handler_unittest.mm b/ios/chrome/app/application_delegate/user_activity_handler_unittest.mm index a9c8cc0e..e693ce3 100644 --- a/ios/chrome/app/application_delegate/user_activity_handler_unittest.mm +++ b/ios/chrome/app/application_delegate/user_activity_handler_unittest.mm
@@ -166,10 +166,12 @@ #pragma mark - Tests. +using UserActivityHandlerNoFixtureTest = PlatformTest; + // Tests that Chrome notifies the user if we are passing a correct // userActivityType. -TEST(UserActivityHandlerNoFixtureTest, - willContinueUserActivityCorrectActivity) { +TEST_F(UserActivityHandlerNoFixtureTest, + willContinueUserActivityCorrectActivity) { EXPECT_TRUE([UserActivityHandler willContinueUserActivityWithType:handoff::kChromeHandoffActivityType]); @@ -181,8 +183,8 @@ // Tests that Chrome does not notifies the user if we are passing an incorrect // userActivityType. -TEST(UserActivityHandlerNoFixtureTest, - willContinueUserActivityIncorrectActivity) { +TEST_F(UserActivityHandlerNoFixtureTest, + willContinueUserActivityIncorrectActivity) { EXPECT_FALSE([UserActivityHandler willContinueUserActivityWithType:[handoff::kChromeHandoffActivityType stringByAppendingString:@"test"]]); @@ -195,9 +197,11 @@ EXPECT_FALSE([UserActivityHandler willContinueUserActivityWithType:nil]); } +using UserActivityHandlerNoFixtureTest = PlatformTest; + // Tests that Chrome does not continue the activity is the activity type is // random. -TEST(UserActivityHandlerNoFixtureTest, continueUserActivityFromGarbage) { +TEST_F(UserActivityHandlerNoFixtureTest, continueUserActivityFromGarbage) { // Setup. NSString* handoffWithSuffix = [handoff::kChromeHandoffActivityType stringByAppendingString:@"test"]; @@ -230,7 +234,7 @@ // Tests that Chrome does not continue the activity if the webpage url is not // set. -TEST(UserActivityHandlerNoFixtureTest, continueUserActivityNoWebpage) { +TEST_F(UserActivityHandlerNoFixtureTest, continueUserActivityNoWebpage) { // Setup. NSUserActivity* userActivity = [[NSUserActivity alloc] initWithActivityType:handoff::kChromeHandoffActivityType]; @@ -253,8 +257,8 @@ // Tests that Chrome does not continue the activity if the activity is a // Spotlight action of an unknown type. -TEST(UserActivityHandlerNoFixtureTest, - continueUserActivitySpotlightActionFromGarbage) { +TEST_F(UserActivityHandlerNoFixtureTest, + continueUserActivitySpotlightActionFromGarbage) { // Only test Spotlight if it is enabled and available on the device. if (!spotlight::IsSpotlightAvailable()) { return; @@ -292,7 +296,7 @@ // Tests that Chrome continues the activity if the application is in background // by saving the url to startupParameters. -TEST(UserActivityHandlerNoFixtureTest, continueUserActivityBackground) { +TEST_F(UserActivityHandlerNoFixtureTest, continueUserActivityBackground) { // Setup. NSUserActivity* userActivity = [[NSUserActivity alloc] initWithActivityType:handoff::kChromeHandoffActivityType]; @@ -327,7 +331,7 @@ // Tests that Chrome continues the activity if the application is in foreground // by opening a new tab. -TEST(UserActivityHandlerNoFixtureTest, continueUserActivityForeground) { +TEST_F(UserActivityHandlerNoFixtureTest, continueUserActivityForeground) { // Setup. NSUserActivity* userActivity = [[NSUserActivity alloc] initWithActivityType:handoff::kChromeHandoffActivityType]; @@ -453,7 +457,7 @@ } // Tests that handleStartupParameters with a non-U2F url opens a new tab. -TEST(UserActivityHandlerNoFixtureTest, handleStartupParamsNonU2F) { +TEST_F(UserActivityHandlerNoFixtureTest, handleStartupParamsNonU2F) { // Setup. GURL gurl("http://www.google.com"); @@ -487,7 +491,7 @@ } // Tests that handleStartupParameters with a U2F url opens in the correct tab. -TEST(UserActivityHandlerNoFixtureTest, handleStartupParamsU2F) { +TEST_F(UserActivityHandlerNoFixtureTest, handleStartupParamsU2F) { // Setup. GURL gurl("chromium://u2f-callback?isU2F=1&tabID=B05B1860"); NSString* tabID = [U2FController tabIDFromResponseURL:gurl];
diff --git a/ios/chrome/app/deferred_initialization_runner_unittest.mm b/ios/chrome/app/deferred_initialization_runner_unittest.mm index 6ed95f99..4ef54834 100644 --- a/ios/chrome/app/deferred_initialization_runner_unittest.mm +++ b/ios/chrome/app/deferred_initialization_runner_unittest.mm
@@ -12,7 +12,9 @@ #error "This file requires ARC support." #endif -TEST(DeferredInitializationRunnerTest, TestSharedInstance) { +using DeferredInitializationRunnerTest = PlatformTest; + +TEST_F(DeferredInitializationRunnerTest, TestSharedInstance) { EXPECT_TRUE([DeferredInitializationRunner sharedInstance]); // Cancelling a non-existing block does nothing. [[DeferredInitializationRunner sharedInstance] @@ -20,7 +22,7 @@ } // Tests that all blocks added on the queue are executed after a delay. -TEST(DeferredInitializationRunnerTest, TestRunBlockSequentially) { +TEST_F(DeferredInitializationRunnerTest, TestRunBlockSequentially) { // Setup. __block bool firstFlag = NO; __block bool secondFlag = NO; @@ -58,7 +60,7 @@ // Tests that runBlockIfNecessary does not execute the block if it has already // been executed and runs synchronously the one not executed. -TEST(DeferredInitializationRunnerTest, TestRunBlock) { +TEST_F(DeferredInitializationRunnerTest, TestRunBlock) { // Setup. __block bool quickFlag = NO; __block bool slowFlag = NO; @@ -98,7 +100,7 @@ // Tests that a block is not executed when cancelled and it is removed from the // remaining blocks list. -TEST(DeferredInitializationRunnerTest, TestCancelBlock) { +TEST_F(DeferredInitializationRunnerTest, TestCancelBlock) { // Setup. __block BOOL blockFinished = NO; DeferredInitializationRunner* runner = @@ -121,7 +123,7 @@ } // Tests that a cancelled block will do nothing when run by name. -TEST(DeferredInitializationRunnerTest, TestCancelledBlockDoNothing) { +TEST_F(DeferredInitializationRunnerTest, TestCancelledBlockDoNothing) { // Setup. __block BOOL blockFinished = NO; DeferredInitializationRunner* runner = @@ -145,7 +147,7 @@ // Tests that adding a block with the same name as an existing block will // override the existing one. -TEST(DeferredInitializationRunnerTest, TestSecondBlockInvalidatesFirst) { +TEST_F(DeferredInitializationRunnerTest, TestSecondBlockInvalidatesFirst) { // Setup. __block int blockRunCount = 0; ProceduralBlock runBlock = ^() {
diff --git a/ios/chrome/app/main_application_delegate_unittest.mm b/ios/chrome/app/main_application_delegate_unittest.mm index 621237d..53432b6 100644 --- a/ios/chrome/app/main_application_delegate_unittest.mm +++ b/ios/chrome/app/main_application_delegate_unittest.mm
@@ -16,10 +16,12 @@ #error "This file requires ARC support." #endif +using MainApplicationDelegateTest = PlatformTest; + // Tests that the application does not crash if |applicationDidEnterBackground| // is called when the application is launched in background. // http://crbug.com/437307 -TEST(MainApplicationDelegateTest, CrashIfNotInitialized) { +TEST_F(MainApplicationDelegateTest, CrashIfNotInitialized) { // Save both ChromeBrowserProvider as MainController register new instance. ios::ChromeBrowserProvider* stashed_chrome_browser_provider = ios::GetChromeBrowserProvider();
diff --git a/ios/chrome/app/main_controller.mm b/ios/chrome/app/main_controller.mm index 5ed965c..44443d7 100644 --- a/ios/chrome/app/main_controller.mm +++ b/ios/chrome/app/main_controller.mm
@@ -1483,6 +1483,26 @@ } } +- (void)showAddAccount { + if (_signinInteractionController) { + // Avoid showing the sign in screen if there is already a sign-in operation + // in progress. + return; + } + + _signinInteractionController = [[SigninInteractionController alloc] + initWithBrowserState:_mainBrowserState + presentingViewController:[self topPresentedViewController] + accessPoint:signin_metrics::AccessPoint::ACCESS_POINT_UNKNOWN + promoAction:signin_metrics::PromoAction:: + PROMO_ACTION_NO_SIGNIN_PROMO + dispatcher:self.mainBVC.dispatcher]; + + [_signinInteractionController addAccountWithCompletion:^(BOOL success) { + _signinInteractionController = nil; + }]; +} + #pragma mark - ApplicationSettingsCommands - (void)showAccountsSettings { @@ -2030,26 +2050,6 @@ } } -- (void)showAddAccount { - if (_signinInteractionController) { - // Avoid showing the sign in screen if there is already a sign-in operation - // in progress. - return; - } - - _signinInteractionController = [[SigninInteractionController alloc] - initWithBrowserState:_mainBrowserState - presentingViewController:[self topPresentedViewController] - accessPoint:signin_metrics::AccessPoint::ACCESS_POINT_UNKNOWN - promoAction:signin_metrics::PromoAction:: - PROMO_ACTION_NO_SIGNIN_PROMO - dispatcher:self.mainBVC.dispatcher]; - - [_signinInteractionController addAccountWithCompletion:^(BOOL success) { - _signinInteractionController = nil; - }]; -} - - (void)dismissSigninInteractionController { // The sign-in interaction controller is destroyed as a result of calling // |cancelAndDismiss|. Destroying it here may lead to a missing call of the
diff --git a/ios/chrome/app/spotlight/spotlight_manager_unittest.mm b/ios/chrome/app/spotlight/spotlight_manager_unittest.mm index 4a08c1a..89bc8ee4 100644 --- a/ios/chrome/app/spotlight/spotlight_manager_unittest.mm +++ b/ios/chrome/app/spotlight/spotlight_manager_unittest.mm
@@ -27,6 +27,7 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -60,7 +61,7 @@ return result; } -class SpotlightManagerTest : public testing::Test { +class SpotlightManagerTest : public PlatformTest { protected: SpotlightManagerTest() { model_ = bookmarks::TestBookmarkClient::CreateModel();
diff --git a/ios/chrome/browser/app_startup_parameters_unittest.mm b/ios/chrome/browser/app_startup_parameters_unittest.mm index de226ab6..6c445a6 100644 --- a/ios/chrome/browser/app_startup_parameters_unittest.mm +++ b/ios/chrome/browser/app_startup_parameters_unittest.mm
@@ -5,6 +5,7 @@ #include "ios/chrome/browser/app_startup_parameters.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #include "url/gurl.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -19,7 +20,9 @@ bool expected_complete_payment_request; }; -TEST(AppStartupParameters, QueryParametersPaymentRequest) { +using AppStartupParametersTest = PlatformTest; + +TEST_F(AppStartupParametersTest, QueryParametersPaymentRequest) { const UniversalLinkDecodeTestCase test_cases[] = { { GURL("https://goo.gl/ioschrome/"), {}, false,
diff --git a/ios/chrome/browser/callback_counter_unittest.mm b/ios/chrome/browser/callback_counter_unittest.mm index 848ab2a..a58911f 100644 --- a/ios/chrome/browser/callback_counter_unittest.mm +++ b/ios/chrome/browser/callback_counter_unittest.mm
@@ -14,8 +14,10 @@ #error "This file requires ARC support." #endif +using CallbackCounterTest = PlatformTest; + // Tests that CallbackCounter works with 2 callbacks. -TEST(CallbackCounterTest, Basic) { +TEST_F(CallbackCounterTest, Basic) { __block BOOL block_was_called = NO; scoped_refptr<CallbackCounter> callback_counter = new CallbackCounter(base::BindBlockArc(^{
diff --git a/ios/chrome/browser/chrome_url_util_unittest.mm b/ios/chrome/browser/chrome_url_util_unittest.mm index 783cac7..a898f46 100644 --- a/ios/chrome/browser/chrome_url_util_unittest.mm +++ b/ios/chrome/browser/chrome_url_util_unittest.mm
@@ -9,6 +9,7 @@ #include "ios/chrome/browser/chrome_url_constants.h" #import "net/base/mac/url_conversions.h" #import "testing/gtest_mac.h" +#include "testing/platform_test.h" #include "url/gurl.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -17,7 +18,9 @@ namespace { -TEST(ChromeURLUtilTest, TestIsExternalFileReference) { +using ChromeURLUtilTest = PlatformTest; + +TEST_F(ChromeURLUtilTest, TestIsExternalFileReference) { GURL external_url("chrome://external-file/foo/bar"); GURL not_external_url("chrome://foo/bar"); GURL still_not_external_url("http://external-file/foo/bar"); @@ -35,7 +38,7 @@ }; // Tests UrlHasChromeScheme with NSURL* parameter. -TEST(ChromeURLUtilTest, NSURLHasChromeScheme) { +TEST_F(ChromeURLUtilTest, NSURLHasChromeScheme) { for (unsigned int i = 0; i < arraysize(kSchemeTestData); ++i) { const char* url = kSchemeTestData[i]; NSURL* nsurl = [NSURL URLWithString:base::SysUTF8ToNSString(url)]; @@ -46,7 +49,7 @@ } // Tests UrlHasChromeScheme with const GURL& paramter. -TEST(ChromeURLUtilTest, GURLHasChromeScheme) { +TEST_F(ChromeURLUtilTest, GURLHasChromeScheme) { for (unsigned int i = 0; i < arraysize(kSchemeTestData); ++i) { GURL gurl(kSchemeTestData[i]); bool result = UrlHasChromeScheme(gurl); @@ -55,7 +58,7 @@ } } -TEST(ChromeURLUtilTest, GetBundleURLScheme) { +TEST_F(ChromeURLUtilTest, GetBundleURLScheme) { // Verifies that there is some default values. ChromeAppConstants* constants = [ChromeAppConstants sharedInstance]; NSString* originalScheme = [constants getBundleURLScheme];
diff --git a/ios/chrome/browser/content_suggestions/content_suggestions_category_wrapper_unittest.mm b/ios/chrome/browser/content_suggestions/content_suggestions_category_wrapper_unittest.mm index 0e18aac..6ae8a72 100644 --- a/ios/chrome/browser/content_suggestions/content_suggestions_category_wrapper_unittest.mm +++ b/ios/chrome/browser/content_suggestions/content_suggestions_category_wrapper_unittest.mm
@@ -6,6 +6,7 @@ #include "components/ntp_snippets/category.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -21,9 +22,11 @@ #pragma mark - Tests. +using ContentSuggestionsCategoryWrapperTest = PlatformTest; + // Tests that the category returned by the wrapper is the one given in the // initializer. -TEST(ContentSuggestionsCategoryWrapperTest, GetCategory) { +TEST_F(ContentSuggestionsCategoryWrapperTest, GetCategory) { // Setup. ntp_snippets::Category category = ntp_snippets::Category::FromIDValue(2); ContentSuggestionsCategoryWrapper* wrapper = @@ -34,7 +37,7 @@ } // Tests that two wrappers created with equal categories are equal. -TEST(ContentSuggestionsCategoryWrapperTest, AreWrappersEqual) { +TEST_F(ContentSuggestionsCategoryWrapperTest, AreWrappersEqual) { // Setup. ntp_snippets::Category category = ntp_snippets::Category::FromIDValue(2); ContentSuggestionsCategoryWrapper* wrapper = @@ -50,7 +53,7 @@ } // Tests that two wrappers created with different categories are not equal. -TEST(ContentSuggestionsCategoryWrapperTest, AreWrappersDifferent) { +TEST_F(ContentSuggestionsCategoryWrapperTest, AreWrappersDifferent) { // Setup. ntp_snippets::Category category = ntp_snippets::Category::FromIDValue(2); ContentSuggestionsCategoryWrapper* wrapper = @@ -65,7 +68,7 @@ } // Tests the equality between a wrapper an different type of objects. -TEST(ContentSuggestionsCategoryWrapperTest, DifferentObject) { +TEST_F(ContentSuggestionsCategoryWrapperTest, DifferentObject) { // Setup. ntp_snippets::Category category = ntp_snippets::Category::FromIDValue(2); ContentSuggestionsCategoryWrapper* wrapper =
diff --git a/ios/chrome/browser/drag_and_drop/drop_and_navigate_interaction_unittest.mm b/ios/chrome/browser/drag_and_drop/drop_and_navigate_interaction_unittest.mm index 2344cd7f..bb70c91 100644 --- a/ios/chrome/browser/drag_and_drop/drop_and_navigate_interaction_unittest.mm +++ b/ios/chrome/browser/drag_and_drop/drop_and_navigate_interaction_unittest.mm
@@ -6,6 +6,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "base/logging.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -13,7 +14,9 @@ namespace { -TEST(DropAndNavigateTest, Instantiation) { +using DropAndNavigateTest = PlatformTest; + +TEST_F(DropAndNavigateTest, Instantiation) { #if defined(__IPHONE_11_0) && (__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0) if (@available(iOS 11, *)) { DropAndNavigateInteraction* interaction =
diff --git a/ios/chrome/browser/favicon/large_icon_cache_unittest.cc b/ios/chrome/browser/favicon/large_icon_cache_unittest.cc index c9823f4..e398684 100644 --- a/ios/chrome/browser/favicon/large_icon_cache_unittest.cc +++ b/ios/chrome/browser/favicon/large_icon_cache_unittest.cc
@@ -9,6 +9,7 @@ #include "components/favicon_base/favicon_types.h" #include "skia/ext/skia_utils_ios.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #include "ui/gfx/codec/png_codec.h" namespace { @@ -38,7 +39,7 @@ return result; } -class LargeIconCacheTest : public testing::Test { +class LargeIconCacheTest : public PlatformTest { public: LargeIconCacheTest() { expected_fallback_icon_style_.reset(new favicon_base::FallbackIconStyle());
diff --git a/ios/chrome/browser/geolocation/CLLocation+XGeoHeaderTest.mm b/ios/chrome/browser/geolocation/CLLocation+XGeoHeaderTest.mm index 76104e8..ecda6c5 100644 --- a/ios/chrome/browser/geolocation/CLLocation+XGeoHeaderTest.mm +++ b/ios/chrome/browser/geolocation/CLLocation+XGeoHeaderTest.mm
@@ -6,6 +6,7 @@ #import "ios/chrome/browser/geolocation/CLLocation+XGeoHeader.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -18,7 +19,9 @@ "zdGFtcDogMTM4OTAwMDAwMDAwMDAwMApyYWRpdXM6IDEwMDAwCmxhdGxuZyA8CiAgbGF0aXR1" "ZGVfZTc6IDM3Nzk2MzIyMAogIGxvbmdpdHVkZV9lNzogLTEyMjQwMDI5MTAKPg=="; -TEST(CLLocationXGeoHeaderTest, TestXGeoString) { +using CLLocationXGeoHeaderTest = PlatformTest; + +TEST_F(CLLocationXGeoHeaderTest, TestXGeoString) { CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake(37.796322, -122.400291); // Picked a fixed timestamp. This one is 2014-01-06 09:20:00 +0000.
diff --git a/ios/chrome/browser/install_time_util_unittest.mm b/ios/chrome/browser/install_time_util_unittest.mm index e539e57..945d154 100644 --- a/ios/chrome/browser/install_time_util_unittest.mm +++ b/ios/chrome/browser/install_time_util_unittest.mm
@@ -5,12 +5,15 @@ #include "ios/chrome/browser/install_time_util.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif -TEST(InstallTimeUtilTest, ComputeInstallationTime) { +using InstallTimeUtilTest = PlatformTest; + +TEST_F(InstallTimeUtilTest, ComputeInstallationTime) { const base::Time null_time = base::Time(); const base::Time now = base::Time::Now(); const base::Time one_month_ago = now - base::TimeDelta::FromDays(30);
diff --git a/ios/chrome/browser/language/language_model_factory_unittest.cc b/ios/chrome/browser/language/language_model_factory_unittest.cc index cd55d3e..b36ce174 100644 --- a/ios/chrome/browser/language/language_model_factory_unittest.cc +++ b/ios/chrome/browser/language/language_model_factory_unittest.cc
@@ -9,15 +9,18 @@ #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #include "ios/web/public/test/test_web_thread_bundle.h" #include "testing/gmock/include/gmock/gmock.h" +#include "testing/platform_test.h" using base::test::ScopedFeatureList; using testing::Eq; using testing::IsNull; using testing::Not; +using LanguageModelFactoryTest = PlatformTest; + // Check that the language model is not returned unless the experiment is // enabled. -TEST(LanguageModelFactoryTest, Disabled) { +TEST_F(LanguageModelFactoryTest, Disabled) { ScopedFeatureList disable_feature; disable_feature.InitAndDisableFeature(language::kUseBaselineLanguageModel); web::TestWebThreadBundle thread_bundle; @@ -35,7 +38,7 @@ } // Check that Incognito language modeling is inherited from the user's profile. -TEST(LanguageModelFactoryTest, SharedWithIncognito) { +TEST_F(LanguageModelFactoryTest, SharedWithIncognito) { ScopedFeatureList enable_feature; enable_feature.InitAndEnableFeature(language::kUseBaselineLanguageModel); web::TestWebThreadBundle thread_bundle;
diff --git a/ios/chrome/browser/language/url_language_histogram_factory_unittest.cc b/ios/chrome/browser/language/url_language_histogram_factory_unittest.cc index de91204..3e18f80 100644 --- a/ios/chrome/browser/language/url_language_histogram_factory_unittest.cc +++ b/ios/chrome/browser/language/url_language_histogram_factory_unittest.cc
@@ -8,11 +8,12 @@ #include "ios/web/public/test/test_web_thread_bundle.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" using testing::IsNull; using testing::Not; -class UrlLanguageHistogramFactoryTest : public testing::Test { +class UrlLanguageHistogramFactoryTest : public PlatformTest { public: UrlLanguageHistogramFactoryTest() { TestChromeBrowserState::Builder browser_state_builder;
diff --git a/ios/chrome/browser/metrics/ios_chrome_metrics_service_accessor_unittest.cc b/ios/chrome/browser/metrics/ios_chrome_metrics_service_accessor_unittest.cc index e3c3094..4e34437 100644 --- a/ios/chrome/browser/metrics/ios_chrome_metrics_service_accessor_unittest.cc +++ b/ios/chrome/browser/metrics/ios_chrome_metrics_service_accessor_unittest.cc
@@ -13,8 +13,9 @@ #include "ios/chrome/test/ios_chrome_scoped_testing_local_state.h" #include "ios/chrome/test/testing_application_context.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" -class IOSChromeMetricsServiceAccessorTest : public testing::Test { +class IOSChromeMetricsServiceAccessorTest : public PlatformTest { public: IOSChromeMetricsServiceAccessorTest() {}
diff --git a/ios/chrome/browser/metrics/ios_chrome_stability_metrics_provider_unittest.cc b/ios/chrome/browser/metrics/ios_chrome_stability_metrics_provider_unittest.cc index a4399c4..9668904 100644 --- a/ios/chrome/browser/metrics/ios_chrome_stability_metrics_provider_unittest.cc +++ b/ios/chrome/browser/metrics/ios_chrome_stability_metrics_provider_unittest.cc
@@ -10,10 +10,11 @@ #include "components/prefs/scoped_user_pref_update.h" #include "components/prefs/testing_pref_service.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" namespace { -class IOSChromeStabilityMetricsProviderTest : public testing::Test { +class IOSChromeStabilityMetricsProviderTest : public PlatformTest { protected: IOSChromeStabilityMetricsProviderTest() : prefs_(new TestingPrefServiceSimple) {
diff --git a/ios/chrome/browser/metrics/mobile_session_shutdown_metrics_provider_unittest.mm b/ios/chrome/browser/metrics/mobile_session_shutdown_metrics_provider_unittest.mm index 83c1a84..5c49d75 100644 --- a/ios/chrome/browser/metrics/mobile_session_shutdown_metrics_provider_unittest.mm +++ b/ios/chrome/browser/metrics/mobile_session_shutdown_metrics_provider_unittest.mm
@@ -19,6 +19,7 @@ #include "components/prefs/testing_pref_service.h" #include "testing/gtest/include/gtest/gtest-param-test.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -67,7 +68,8 @@ }; class MobileSessionShutdownMetricsProviderTest - : public testing::TestWithParam<int> { + : public PlatformTest, + public testing::WithParamInterface<int> { public: MobileSessionShutdownMetricsProviderTest() { metrics::MetricsService::RegisterPrefs(local_state_.registry());
diff --git a/ios/chrome/browser/metrics/previous_session_info_unittest.mm b/ios/chrome/browser/metrics/previous_session_info_unittest.mm index 5168ed0..f991d63 100644 --- a/ios/chrome/browser/metrics/previous_session_info_unittest.mm +++ b/ios/chrome/browser/metrics/previous_session_info_unittest.mm
@@ -9,6 +9,7 @@ #include "ios/chrome/browser/metrics/previous_session_info_private.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -25,7 +26,9 @@ // last session. NSString* const kLastRanVersion = @"LastRanVersion"; -TEST(PreviousSessionInfoTest, InitializationWithEmptyDefaults) { +using PreviousSessionInfoTest = PlatformTest; + +TEST_F(PreviousSessionInfoTest, InitializationWithEmptyDefaults) { [PreviousSessionInfo resetSharedInstanceForTesting]; NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; [defaults removeObjectForKey:kDidSeeMemoryWarningShortlyBeforeTerminating]; @@ -39,7 +42,7 @@ EXPECT_TRUE([sharedInstance isFirstSessionAfterUpgrade]); } -TEST(PreviousSessionInfoTest, InitializationWithSameVersionNoMemoryWarning) { +TEST_F(PreviousSessionInfoTest, InitializationWithSameVersionNoMemoryWarning) { [PreviousSessionInfo resetSharedInstanceForTesting]; NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; [defaults removeObjectForKey:kDidSeeMemoryWarningShortlyBeforeTerminating]; @@ -58,7 +61,7 @@ EXPECT_FALSE([sharedInstance isFirstSessionAfterUpgrade]); } -TEST(PreviousSessionInfoTest, InitializationWithSameVersionMemoryWarning) { +TEST_F(PreviousSessionInfoTest, InitializationWithSameVersionMemoryWarning) { [PreviousSessionInfo resetSharedInstanceForTesting]; NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; [defaults removeObjectForKey:kDidSeeMemoryWarningShortlyBeforeTerminating]; @@ -80,7 +83,7 @@ EXPECT_FALSE([sharedInstance isFirstSessionAfterUpgrade]); } -TEST(PreviousSessionInfoTest, InitializationDifferentVersionNoMemoryWarning) { +TEST_F(PreviousSessionInfoTest, InitializationDifferentVersionNoMemoryWarning) { [PreviousSessionInfo resetSharedInstanceForTesting]; NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; [defaults removeObjectForKey:kDidSeeMemoryWarningShortlyBeforeTerminating]; @@ -97,7 +100,7 @@ EXPECT_TRUE([sharedInstance isFirstSessionAfterUpgrade]); } -TEST(PreviousSessionInfoTest, InitializationDifferentVersionMemoryWarning) { +TEST_F(PreviousSessionInfoTest, InitializationDifferentVersionMemoryWarning) { [PreviousSessionInfo resetSharedInstanceForTesting]; NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; [defaults removeObjectForKey:kDidSeeMemoryWarningShortlyBeforeTerminating]; @@ -117,7 +120,7 @@ EXPECT_TRUE([sharedInstance isFirstSessionAfterUpgrade]); } -TEST(PreviousSessionInfoTest, BeginRecordingCurrentSession) { +TEST_F(PreviousSessionInfoTest, BeginRecordingCurrentSession) { [PreviousSessionInfo resetSharedInstanceForTesting]; NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; [defaults removeObjectForKey:kDidSeeMemoryWarningShortlyBeforeTerminating]; @@ -137,7 +140,7 @@ [defaults boolForKey:kDidSeeMemoryWarningShortlyBeforeTerminating]); } -TEST(PreviousSessionInfoTest, SetMemoryWarningFlagNoOpUntilRecordingBegins) { +TEST_F(PreviousSessionInfoTest, SetMemoryWarningFlagNoOpUntilRecordingBegins) { [PreviousSessionInfo resetSharedInstanceForTesting]; NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; [defaults removeObjectForKey:kDidSeeMemoryWarningShortlyBeforeTerminating]; @@ -150,7 +153,8 @@ [defaults boolForKey:kDidSeeMemoryWarningShortlyBeforeTerminating]); } -TEST(PreviousSessionInfoTest, ResetMemoryWarningFlagNoOpUntilRecordingBegins) { +TEST_F(PreviousSessionInfoTest, + ResetMemoryWarningFlagNoOpUntilRecordingBegins) { [PreviousSessionInfo resetSharedInstanceForTesting]; NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; [defaults removeObjectForKey:kDidSeeMemoryWarningShortlyBeforeTerminating]; @@ -166,7 +170,7 @@ [defaults boolForKey:kDidSeeMemoryWarningShortlyBeforeTerminating]); } -TEST(PreviousSessionInfoTest, MemoryWarningFlagMethodsAfterRecordingBegins) { +TEST_F(PreviousSessionInfoTest, MemoryWarningFlagMethodsAfterRecordingBegins) { [PreviousSessionInfo resetSharedInstanceForTesting]; NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults]; [defaults removeObjectForKey:kDidSeeMemoryWarningShortlyBeforeTerminating];
diff --git a/ios/chrome/browser/net/cookie_util_unittest.mm b/ios/chrome/browser/net/cookie_util_unittest.mm index 1597e8d3..42a2bd9 100644 --- a/ios/chrome/browser/net/cookie_util_unittest.mm +++ b/ios/chrome/browser/net/cookie_util_unittest.mm
@@ -7,6 +7,7 @@ #import <Foundation/Foundation.h> #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -19,7 +20,9 @@ } // namespace -TEST(CookieUtil, ShouldClearSessionCookies) { +using CookieUtil = PlatformTest; + +TEST_F(CookieUtil, ShouldClearSessionCookies) { time_t start_test_time; time(&start_test_time); NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
diff --git a/ios/chrome/browser/notification_promo_unittest.cc b/ios/chrome/browser/notification_promo_unittest.cc index 25b68ab..bbadaeb 100644 --- a/ios/chrome/browser/notification_promo_unittest.cc +++ b/ios/chrome/browser/notification_promo_unittest.cc
@@ -21,6 +21,7 @@ #include "components/variations/variations_associated_data.h" #include "ios/chrome/browser/notification_promo.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #include "third_party/icu/source/i18n/unicode/smpdtfmt.h" namespace ios { @@ -47,7 +48,7 @@ } // namespace -class NotificationPromoTest : public testing::Test { +class NotificationPromoTest : public PlatformTest { public: NotificationPromoTest() : notification_promo_(&local_state_),
diff --git a/ios/chrome/browser/passwords/credential_manager_util_unittest.cc b/ios/chrome/browser/passwords/credential_manager_util_unittest.cc index 872d5090..ae4f981 100644 --- a/ios/chrome/browser/passwords/credential_manager_util_unittest.cc +++ b/ios/chrome/browser/passwords/credential_manager_util_unittest.cc
@@ -47,9 +47,11 @@ } // namespace +using CredentialManagerUtilTest = PlatformTest; + // Checks that CredentialRequestOptions.password field is parsed // correctly. -TEST(CredentialManagerUtilTest, ParseIncludePasswords) { +TEST_F(CredentialManagerUtilTest, ParseIncludePasswords) { base::DictionaryValue json; bool include_passwords = true; @@ -73,7 +75,7 @@ // Checks that CredentialRequestOptions.mediation field is parsed // correctly. -TEST(CredentialManagerUtilTest, ParseMediationRequirement) { +TEST_F(CredentialManagerUtilTest, ParseMediationRequirement) { base::DictionaryValue json; CredentialMediationRequirement mediation; @@ -100,7 +102,7 @@ } // Checks that Credential.type field is parsed correctly. -TEST(CredentialManagerUtilTest, ParseCredentialType) { +TEST_F(CredentialManagerUtilTest, ParseCredentialType) { base::DictionaryValue json; CredentialType type = CredentialType::CREDENTIAL_TYPE_EMPTY; @@ -128,7 +130,7 @@ // Checks that common fields of PasswordCredential and FederatedCredential are // parsed correctly. -TEST(CredentialManagerUtilTest, ParseCommonCredentialFields) { +TEST_F(CredentialManagerUtilTest, ParseCommonCredentialFields) { // Building PasswordCredential because ParseCredentialDictionary for // Credential containing only common fields would return false. base::DictionaryValue json = BuildExampleValidPasswordCredential(); @@ -170,7 +172,7 @@ // Checks that |password| and |type| fields of PasswordCredential are parsed // correctly. -TEST(CredentialManagerUtilTest, ParsePasswordCredential) { +TEST_F(CredentialManagerUtilTest, ParsePasswordCredential) { base::DictionaryValue json = BuildExampleValidPasswordCredential(); CredentialInfo credential; std::string reason; @@ -194,7 +196,7 @@ // Checks that |provider| and |type| fields of FederatedCredential are parsed // correctly. -TEST(CredentialManagerUtilTest, ParseFederatedCredential) { +TEST_F(CredentialManagerUtilTest, ParseFederatedCredential) { base::DictionaryValue json = BuildExampleValidFederatedCredential(); CredentialInfo credential; std::string reason; @@ -223,7 +225,7 @@ // Checks that |providers| field of FederatedCredentialRequestOptions is // parsed correctly. -TEST(CredentialManagerUtilTest, ParseFederations) { +TEST_F(CredentialManagerUtilTest, ParseFederations) { base::DictionaryValue json; // Build example valid |providers| list.
diff --git a/ios/chrome/browser/passwords/password_controller_unittest.mm b/ios/chrome/browser/passwords/password_controller_unittest.mm index a529927..f3d3718 100644 --- a/ios/chrome/browser/passwords/password_controller_unittest.mm +++ b/ios/chrome/browser/passwords/password_controller_unittest.mm
@@ -39,6 +39,7 @@ #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #import "third_party/ocmock/OCMock/OCMock.h" #import "third_party/ocmock/OCMock/OCPartialMockObject.h" #include "url/gurl.h" @@ -1292,9 +1293,11 @@ } } +using PasswordControllerTestSimple = PlatformTest; + // The test case below does not need the heavy fixture from above, but it // needs to use MockWebState. -TEST(PasswordControllerTestSimple, SaveOnNonHTMLLandingPage) { +TEST_F(PasswordControllerTestSimple, SaveOnNonHTMLLandingPage) { base::test::ScopedTaskEnvironment task_environment; TestChromeBrowserState::Builder builder; std::unique_ptr<TestChromeBrowserState> browser_state(builder.Build());
diff --git a/ios/chrome/browser/payments/ios_payment_instrument_finder_unittest.mm b/ios/chrome/browser/payments/ios_payment_instrument_finder_unittest.mm index 4da1ef68..5a3342c 100644 --- a/ios/chrome/browser/payments/ios_payment_instrument_finder_unittest.mm +++ b/ios/chrome/browser/payments/ios_payment_instrument_finder_unittest.mm
@@ -13,6 +13,7 @@ #include "net/url_request/url_request_test_util.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -35,7 +36,7 @@ DISALLOW_COPY_AND_ASSIGN(TestIOSPaymentInstrumentFinder); }; -class PaymentRequestIOSPaymentInstrumentFinderTest : public testing::Test { +class PaymentRequestIOSPaymentInstrumentFinderTest : public PlatformTest { public: PaymentRequestIOSPaymentInstrumentFinderTest() : scoped_task_environment_(
diff --git a/ios/chrome/browser/payments/ios_payment_instrument_launcher_unittest.mm b/ios/chrome/browser/payments/ios_payment_instrument_launcher_unittest.mm index 2ae17aa6..a0d1600 100644 --- a/ios/chrome/browser/payments/ios_payment_instrument_launcher_unittest.mm +++ b/ios/chrome/browser/payments/ios_payment_instrument_launcher_unittest.mm
@@ -22,6 +22,7 @@ #include "ios/web/public/test/fakes/test_navigation_manager.h" #import "ios/web/public/test/fakes/test_web_state.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -71,7 +72,7 @@ } // namespace -class PaymentRequestIOSPaymentInstrumentLauncherTest : public testing::Test { +class PaymentRequestIOSPaymentInstrumentLauncherTest : public PlatformTest { protected: PaymentRequestIOSPaymentInstrumentLauncherTest() : chrome_browser_state_(TestChromeBrowserState::Builder().Build()) {}
diff --git a/ios/chrome/browser/payments/payment_request_unittest.mm b/ios/chrome/browser/payments/payment_request_unittest.mm index 559aad4f3..51c34638 100644 --- a/ios/chrome/browser/payments/payment_request_unittest.mm +++ b/ios/chrome/browser/payments/payment_request_unittest.mm
@@ -29,6 +29,7 @@ #include "testing/gmock/include/gmock/gmock-matchers.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -50,7 +51,7 @@ namespace payments { -class PaymentRequestTest : public testing::Test { +class PaymentRequestTest : public PlatformTest { protected: PaymentRequestTest() : chrome_browser_state_(TestChromeBrowserState::Builder().Build()) {}
diff --git a/ios/chrome/browser/reading_list/offline_url_utils_unittest.cc b/ios/chrome/browser/reading_list/offline_url_utils_unittest.cc index 0229ceb9..60b03dc 100644 --- a/ios/chrome/browser/reading_list/offline_url_utils_unittest.cc +++ b/ios/chrome/browser/reading_list/offline_url_utils_unittest.cc
@@ -14,11 +14,14 @@ #include "components/reading_list/core/reading_list_entry.h" #include "components/reading_list/core/reading_list_model_impl.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #include "url/gurl.h" +using OfflineURLUtilsTest = PlatformTest; + // Checks the distilled URL for the page with an onlineURL is // chrome://offline/MD5/page.html?entryURL=...&virtualURL=... -TEST(OfflineURLUtilsTest, OfflineURLForPathWithEntryURLAndVirtualURLTest) { +TEST_F(OfflineURLUtilsTest, OfflineURLForPathWithEntryURLAndVirtualURLTest) { base::FilePath page_path("MD5/page.html"); GURL entry_url = GURL("http://foo.bar"); GURL virtual_url = GURL("http://foo.bar/virtual"); @@ -33,7 +36,7 @@ // Checks the parsing of offline URL chrome://offline/MD5/page.html. // As entryURL and virtualURL are absent, they should be invalid. -TEST(OfflineURLUtilsTest, ParseOfflineURLTest) { +TEST_F(OfflineURLUtilsTest, ParseOfflineURLTest) { GURL distilled_url("chrome://offline/MD5/page.html"); GURL entry_url = reading_list::EntryURLForOfflineURL(distilled_url); EXPECT_TRUE(entry_url.is_empty()); @@ -45,7 +48,7 @@ // chrome://offline/MD5/page.html?entryURL=encorded%20URL // As entryURL is present, it should be returned correctly. // As virtualURL is absent, it should return GURL::EmptyGURL(). -TEST(OfflineURLUtilsTest, ParseOfflineURLWithEntryURLTest) { +TEST_F(OfflineURLUtilsTest, ParseOfflineURLWithEntryURLTest) { GURL offline_url( "chrome://offline/MD5/page.html?entryURL=http%3A%2F%2Ffoo.bar%2F"); GURL entry_url = reading_list::EntryURLForOfflineURL(offline_url); @@ -58,7 +61,7 @@ // chrome://offline/MD5/page.html?virtualURL=encorded%20URL // As entryURL is absent, it should return the offline URL. // As virtualURL is present, it should be returned correctly. -TEST(OfflineURLUtilsTest, ParseOfflineURLWithVirtualURLTest) { +TEST_F(OfflineURLUtilsTest, ParseOfflineURLWithVirtualURLTest) { GURL offline_url( "chrome://offline/MD5/page.html?virtualURL=http%3A%2F%2Ffoo.bar%2F"); GURL entry_url = reading_list::EntryURLForOfflineURL(offline_url); @@ -71,7 +74,7 @@ // chrome://offline/MD5/page.html?entryURL=...&virtualURL=... // As entryURL is present, it should be returned correctly. // As virtualURL is present, it should be returned correctly. -TEST(OfflineURLUtilsTest, ParseOfflineURLWithVirtualAndEntryURLTest) { +TEST_F(OfflineURLUtilsTest, ParseOfflineURLWithVirtualAndEntryURLTest) { GURL offline_url( "chrome://offline/MD5/" "page.html?virtualURL=http%3A%2F%2Ffoo.bar%2Fvirtual&entryURL=http%3A%2F%" @@ -86,7 +89,7 @@ // file://profile_path/Offline/MD5/page.html. // Checks the resource root for chrome://offline/MD5/page.html is // file://profile_path/Offline/MD5 -TEST(OfflineURLUtilsTest, FileURLForDistilledURLTest) { +TEST_F(OfflineURLUtilsTest, FileURLForDistilledURLTest) { base::FilePath offline_path("/profile_path/Offline"); GURL file_url = reading_list::FileURLForDistilledURL(GURL(), offline_path, nullptr); @@ -108,7 +111,7 @@ } // Checks that the offline URLs are correctly detected by |IsOfflineURL|. -TEST(OfflineURLUtilsTest, IsOfflineURL) { +TEST_F(OfflineURLUtilsTest, IsOfflineURL) { EXPECT_FALSE(reading_list::IsOfflineURL(GURL())); EXPECT_FALSE(reading_list::IsOfflineURL(GURL("chrome://"))); EXPECT_FALSE(reading_list::IsOfflineURL(GURL("chrome://offline-foobar"))); @@ -122,7 +125,7 @@ } // Checks that the offline URLs are correctly detected by |IsOfflineURL|. -TEST(OfflineURLUtilsTest, IsOfflineURLValid) { +TEST_F(OfflineURLUtilsTest, IsOfflineURLValid) { auto reading_list_model = base::MakeUnique<ReadingListModelImpl>( nullptr, nullptr, base::MakeUnique<base::DefaultClock>()); GURL entry_url("http://entry_url.com");
diff --git a/ios/chrome/browser/reading_list/url_downloader_unittest.mm b/ios/chrome/browser/reading_list/url_downloader_unittest.mm index 63355a26..2ebeb307 100644 --- a/ios/chrome/browser/reading_list/url_downloader_unittest.mm +++ b/ios/chrome/browser/reading_list/url_downloader_unittest.mm
@@ -18,6 +18,7 @@ #include "ios/chrome/browser/reading_list/offline_url_utils.h" #include "ios/chrome/browser/reading_list/reading_list_distiller_page.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -137,7 +138,7 @@ }; namespace { -class URLDownloaderTest : public testing::Test { +class URLDownloaderTest : public PlatformTest { public: URLDownloaderTest() { base::FilePath data_dir;
diff --git a/ios/chrome/browser/snapshots/lru_cache_unittest.mm b/ios/chrome/browser/snapshots/lru_cache_unittest.mm index 31b3220..70987da 100644 --- a/ios/chrome/browser/snapshots/lru_cache_unittest.mm +++ b/ios/chrome/browser/snapshots/lru_cache_unittest.mm
@@ -4,6 +4,7 @@ #import "ios/chrome/browser/snapshots/lru_cache.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -11,7 +12,9 @@ namespace { -TEST(LRUCacheTest, Basic) { +using LRUCacheTest = PlatformTest; + +TEST_F(LRUCacheTest, Basic) { LRUCache* cache = [[LRUCache alloc] initWithCacheSize:3]; NSString* value1 = @"Value 1";
diff --git a/ios/chrome/browser/snapshots/snapshots_util_unittest.mm b/ios/chrome/browser/snapshots/snapshots_util_unittest.mm index 910160d..3722add 100644 --- a/ios/chrome/browser/snapshots/snapshots_util_unittest.mm +++ b/ios/chrome/browser/snapshots/snapshots_util_unittest.mm
@@ -12,6 +12,7 @@ #include "base/path_service.h" #include "base/strings/sys_string_conversions.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -39,7 +40,9 @@ return numberOfMatches == 1; } -TEST(SnapshotsUtilTest, TestSnapshotList) { +using SnapshotsUtilTest = PlatformTest; + +TEST_F(SnapshotsUtilTest, TestSnapshotList) { NSString* scaleModifier = @""; CGFloat scale = [UIScreen mainScreen].scale; if (scale > 1) {
diff --git a/ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory_unittest.cc b/ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory_unittest.cc index 62eb0d2..b718fbf 100644 --- a/ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory_unittest.cc +++ b/ios/chrome/browser/sync/ios_chrome_profile_sync_service_factory_unittest.cc
@@ -17,10 +17,11 @@ #include "ios/chrome/browser/browser_state/test_chrome_browser_state.h" #include "ios/web/public/test/test_web_thread_bundle.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" using syncer::DataTypeController; -class IOSChromeProfileSyncServiceFactoryTest : public testing::Test { +class IOSChromeProfileSyncServiceFactoryTest : public PlatformTest { public: IOSChromeProfileSyncServiceFactoryTest() { TestChromeBrowserState::Builder browser_state_builder;
diff --git a/ios/chrome/browser/tabs/tab.mm b/ios/chrome/browser/tabs/tab.mm index 5de9aca8a..73bd6d0 100644 --- a/ios/chrome/browser/tabs/tab.mm +++ b/ios/chrome/browser/tabs/tab.mm
@@ -78,7 +78,6 @@ #import "ios/chrome/browser/tabs/tab_snapshotting_delegate.h" #include "ios/chrome/browser/translate/chrome_ios_translate_client.h" #import "ios/chrome/browser/u2f/u2f_controller.h" -#import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" #import "ios/chrome/browser/ui/commands/application_commands.h" #import "ios/chrome/browser/ui/commands/browser_commands.h" #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" @@ -1357,9 +1356,7 @@ signin_metrics::LogAccountReconcilorStateOnGaiaResponse( ios::AccountReconcilorFactory::GetForBrowserState(_browserState) ->GetState()); - GenericChromeCommand* command = - [[GenericChromeCommand alloc] initWithTag:IDC_SHOW_ADD_ACCOUNT]; - [self.view chromeExecuteCommand:command]; + [self.dispatcher showAddAccount]; } - (void)onGoIncognito:(const GURL&)url {
diff --git a/ios/chrome/browser/translate/translate_service_ios_unittest.cc b/ios/chrome/browser/translate/translate_service_ios_unittest.cc index 6f7e032..fbd0d8a 100644 --- a/ios/chrome/browser/translate/translate_service_ios_unittest.cc +++ b/ios/chrome/browser/translate/translate_service_ios_unittest.cc
@@ -7,9 +7,12 @@ #include "ios/chrome/browser/chrome_url_constants.h" #include "ios/public/provider/chrome/browser/test_chrome_provider_initializer.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #include "url/gurl.h" -TEST(TranslateServiceIOSTest, CheckTranslatableURL) { +using TranslateServiceIOSTest = PlatformTest; + +TEST_F(TranslateServiceIOSTest, CheckTranslatableURL) { GURL empty_url = GURL(std::string()); EXPECT_FALSE(TranslateServiceIOS::IsTranslatableURL(empty_url));
diff --git a/ios/chrome/browser/ui/activity_services/activity_type_util_unittest.mm b/ios/chrome/browser/ui/activity_services/activity_type_util_unittest.mm index d7240cf..178025ab 100644 --- a/ios/chrome/browser/ui/activity_services/activity_type_util_unittest.mm +++ b/ios/chrome/browser/ui/activity_services/activity_type_util_unittest.mm
@@ -9,6 +9,7 @@ #include "ios/chrome/grit/ios_strings.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #include "ui/base/l10n/l10n_util_mac.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -22,7 +23,9 @@ EXPECT_EQ(activity_type_util::TypeFromString(activityString), expectedType); } -TEST(ActivityTypeUtilTest, StringToTypeTest) { +using ActivityTypeUtilTest = PlatformTest; + +TEST_F(ActivityTypeUtilTest, StringToTypeTest) { StringToTypeTestHelper(@"", activity_type_util::UNKNOWN); StringToTypeTestHelper(@"foo", activity_type_util::UNKNOWN); StringToTypeTestHelper(@"com.google", activity_type_util::UNKNOWN); @@ -45,7 +48,7 @@ expectedMessage); } -TEST(ActivityTypeUtilTest, TypeToMessageTest) { +TEST_F(ActivityTypeUtilTest, TypeToMessageTest) { TypeToMessageTestHelper(activity_type_util::UNKNOWN, nil); TypeToMessageTestHelper(activity_type_util::PRINT, nil); TypeToMessageTestHelper( @@ -56,7 +59,7 @@ l10n_util::GetNSString(IDS_IOS_APPEX_PASSWORD_FORM_FILLED_SUCCESS)); } -TEST(ActivityTypeUtilTest, IsPasswordAppExtensionTest) { +TEST_F(ActivityTypeUtilTest, IsPasswordAppExtensionTest) { // Verifies that known Bundle ID for 1Password requires exact match. EXPECT_EQ(activity_type_util::APPEX_PASSWORD_MANAGEMENT, activity_type_util::TypeFromString(
diff --git a/ios/chrome/browser/ui/activity_services/share_to_data_builder_unittest.mm b/ios/chrome/browser/ui/activity_services/share_to_data_builder_unittest.mm index 7d6e58c2..c8f1acf 100644 --- a/ios/chrome/browser/ui/activity_services/share_to_data_builder_unittest.mm +++ b/ios/chrome/browser/ui/activity_services/share_to_data_builder_unittest.mm
@@ -12,6 +12,7 @@ #import "ios/web/web_state/web_state_impl.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #import "third_party/ocmock/OCMock/OCMock.h" #import "ui/base/test/ios/ui_image_test_utils.h" @@ -47,8 +48,10 @@ } @end +using ShareToDataBuilderTest = PlatformTest; + // Verifies that ShareToData is constructed properly for a given Tab. -TEST(ShareToDataBuilderTest, TestSharePageCommandHandling) { +TEST_F(ShareToDataBuilderTest, TestSharePageCommandHandling) { GURL expected_url("http://www.testurl.net"); NSString* expected_title = @"title"; @@ -94,7 +97,7 @@ // Verifies that |ShareToDataForTab()| returns nil if the Tab is in the process // of being closed. -TEST(ShareToDataBuilderTest, TestReturnsNilWhenClosing) { +TEST_F(ShareToDataBuilderTest, TestReturnsNilWhenClosing) { GURL expected_url("http://www.testurl.net"); NSString* expected_title = @"title";
diff --git a/ios/chrome/browser/ui/alert_coordinator/action_sheet_coordinator_unittest.mm b/ios/chrome/browser/ui/alert_coordinator/action_sheet_coordinator_unittest.mm index 9437ff3d..a935e35 100644 --- a/ios/chrome/browser/ui/alert_coordinator/action_sheet_coordinator_unittest.mm +++ b/ios/chrome/browser/ui/alert_coordinator/action_sheet_coordinator_unittest.mm
@@ -14,8 +14,10 @@ #error "This file requires ARC support." #endif +using ActionSheetCoordinatorTest = PlatformTest; + // Tests that if there is a popover, it uses the CGRect passed in init. -TEST(ActionSheetCoordinatorTest, CGRectUsage) { +TEST_F(ActionSheetCoordinatorTest, CGRectUsage) { ScopedKeyWindow scoped_key_window; UIViewController* viewController = [[UIViewController alloc] init]; [scoped_key_window.Get() setRootViewController:viewController];
diff --git a/ios/chrome/browser/ui/alert_coordinator/input_alert_coordinator_unittest.mm b/ios/chrome/browser/ui/alert_coordinator/input_alert_coordinator_unittest.mm index 5cbf932..2c4bd18 100644 --- a/ios/chrome/browser/ui/alert_coordinator/input_alert_coordinator_unittest.mm +++ b/ios/chrome/browser/ui/alert_coordinator/input_alert_coordinator_unittest.mm
@@ -12,7 +12,9 @@ #error "This file requires ARC support." #endif -TEST(InputAlertCoordinatorTest, AddTextField) { +using InputAlertCoordinatorTest = PlatformTest; + +TEST_F(InputAlertCoordinatorTest, AddTextField) { // Setup. UIViewController* viewController = [[UIViewController alloc] init]; InputAlertCoordinator* alertCoordinator = @@ -33,7 +35,7 @@ EXPECT_OCMOCK_VERIFY(alert); } -TEST(InputAlertCoordinatorTest, GetTextFields) { +TEST_F(InputAlertCoordinatorTest, GetTextFields) { // Setup. UIViewController* viewController = [[UIViewController alloc] init]; InputAlertCoordinator* alertCoordinator =
diff --git a/ios/chrome/browser/ui/authentication/account_control_item_unittest.mm b/ios/chrome/browser/ui/authentication/account_control_item_unittest.mm index f4aa9a8..4b8dda42 100644 --- a/ios/chrome/browser/ui/authentication/account_control_item_unittest.mm +++ b/ios/chrome/browser/ui/authentication/account_control_item_unittest.mm
@@ -7,14 +7,17 @@ #import "ios/chrome/browser/ui/colors/MDCPalette+CrAdditions.h" #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif +using AccountControlItemTest = PlatformTest; + // Tests that the cell is properly configured with image and texts after a call // to |configureCell:|. All other cell decorations are default. -TEST(AccountControlItemTest, ConfigureCellDefault) { +TEST_F(AccountControlItemTest, ConfigureCellDefault) { AccountControlItem* item = [[AccountControlItem alloc] initWithType:0]; UIImage* image = [[UIImage alloc] init]; NSString* mainText = @"Main text"; @@ -47,7 +50,7 @@ // Tests that the cell is properly configured with error and an accessory after // a call to |configureCell:|. -TEST(AccountControlItemTest, ConfigureCellWithErrorAndAccessory) { +TEST_F(AccountControlItemTest, ConfigureCellWithErrorAndAccessory) { AccountControlItem* item = [[AccountControlItem alloc] initWithType:0]; UIImage* image = [[UIImage alloc] init]; NSString* mainText = @"Main text";
diff --git a/ios/chrome/browser/ui/authentication/authentication_ui_util_unittest.mm b/ios/chrome/browser/ui/authentication/authentication_ui_util_unittest.mm index eea4959..a7e829b 100644 --- a/ios/chrome/browser/ui/authentication/authentication_ui_util_unittest.mm +++ b/ios/chrome/browser/ui/authentication/authentication_ui_util_unittest.mm
@@ -24,8 +24,10 @@ } } +using AuthenticationUIUtil = PlatformTest; + // Tests the error message with one error with a localized description. -TEST(AuthenticationUIUtil, DialogMessageFromErrorWithLocalizedDescription) { +TEST_F(AuthenticationUIUtil, DialogMessageFromErrorWithLocalizedDescription) { NSDictionary* userInfo = @{NSLocalizedDescriptionKey : @"MyLocalizedDescription"}; NSError* error = @@ -35,7 +37,8 @@ } // Tests the error message with one error without a localized description. -TEST(AuthenticationUIUtil, DialogMessageFromErrorWithoutLocalizedDescription) { +TEST_F(AuthenticationUIUtil, + DialogMessageFromErrorWithoutLocalizedDescription) { NSError* error = [NSError errorWithDomain:@"MyErrorDomain" code:-1234 userInfo:nil]; NSString* message = DialogMessageFromError(error); @@ -43,7 +46,7 @@ } // Tests the error message with an error with 2 underlying errors. -TEST(AuthenticationUIUtil, DialogMessageFromErrorWithUnderlyingErrors) { +TEST_F(AuthenticationUIUtil, DialogMessageFromErrorWithUnderlyingErrors) { // Error 1 NSDictionary* userInfo1 = @{NSLocalizedDescriptionKey : @"MyLocalizedDescription1"};
diff --git a/ios/chrome/browser/ui/authentication/signin_promo_item_unittest.mm b/ios/chrome/browser/ui/authentication/signin_promo_item_unittest.mm index 60a81c7..8cff5478 100644 --- a/ios/chrome/browser/ui/authentication/signin_promo_item_unittest.mm +++ b/ios/chrome/browser/ui/authentication/signin_promo_item_unittest.mm
@@ -7,6 +7,7 @@ #import "ios/chrome/browser/ui/authentication/signin_promo_view.h" #import "ios/chrome/browser/ui/authentication/signin_promo_view_configurator.h" #import "testing/gtest_mac.h" +#include "testing/platform_test.h" #import "third_party/ocmock/OCMock/OCMock.h" #include "third_party/ocmock/gtest_support.h" @@ -14,8 +15,10 @@ #error "This file requires ARC support." #endif +using SigninPromoItemTest = PlatformTest; + // Tests that SigninPromoItem creates and configures correctly SigninPromoCell. -TEST(SigninPromoItemTest, ConfigureCell) { +TEST_F(SigninPromoItemTest, ConfigureCell) { SigninPromoViewConfigurator* configurator = OCMStrictClassMock([SigninPromoViewConfigurator class]); SigninPromoItem* item = [[SigninPromoItem alloc] initWithType:0];
diff --git a/ios/chrome/browser/ui/authentication/signin_promo_view_unittest.mm b/ios/chrome/browser/ui/authentication/signin_promo_view_unittest.mm index cae39c49..99bf5b4e 100644 --- a/ios/chrome/browser/ui/authentication/signin_promo_view_unittest.mm +++ b/ios/chrome/browser/ui/authentication/signin_promo_view_unittest.mm
@@ -5,13 +5,16 @@ #import "ios/chrome/browser/ui/authentication/signin_promo_view.h" #import "ios/third_party/material_components_ios/src/components/Buttons/src/MaterialButtons.h" +#include "testing/platform_test.h" #include "third_party/ocmock/gtest_support.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif -TEST(SigninPromoViewTest, ChromiumLogoImage) { +using SigninPromoViewTest = PlatformTest; + +TEST_F(SigninPromoViewTest, ChromiumLogoImage) { SigninPromoView* view = [[SigninPromoView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]; view.mode = SigninPromoViewModeColdState; @@ -28,7 +31,7 @@ EXPECT_NE(customImage, view.imageView.image); } -TEST(SigninPromoViewTest, SecondaryButtonVisibility) { +TEST_F(SigninPromoViewTest, SecondaryButtonVisibility) { SigninPromoView* view = [[SigninPromoView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]; view.mode = SigninPromoViewModeColdState;
diff --git a/ios/chrome/browser/ui/autofill/cells/autofill_edit_item_unittest.mm b/ios/chrome/browser/ui/autofill/cells/autofill_edit_item_unittest.mm index a11f726..ed34ad3 100644 --- a/ios/chrome/browser/ui/autofill/cells/autofill_edit_item_unittest.mm +++ b/ios/chrome/browser/ui/autofill/cells/autofill_edit_item_unittest.mm
@@ -6,6 +6,7 @@ #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -13,9 +14,11 @@ namespace { +using AutofillEditItemTest = PlatformTest; + // Tests that the label and text field are set properly after a call to // |configureCell:|. -TEST(AutofillEditItemTest, ConfigureCell) { +TEST_F(AutofillEditItemTest, ConfigureCell) { AutofillEditItem* item = [[AutofillEditItem alloc] initWithType:0]; NSString* name = @"Name"; NSString* value = @"Value";
diff --git a/ios/chrome/browser/ui/autofill/cells/cvc_item_unittest.mm b/ios/chrome/browser/ui/autofill/cells/cvc_item_unittest.mm index d6ee18b..a473568 100644 --- a/ios/chrome/browser/ui/autofill/cells/cvc_item_unittest.mm +++ b/ios/chrome/browser/ui/autofill/cells/cvc_item_unittest.mm
@@ -8,6 +8,7 @@ #include "components/grit/components_scaled_resources.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -19,9 +20,11 @@ namespace { +using CVCItemTest = PlatformTest; + // Tests that the cell subviews are set properly after a call to // |configureCell:| in the different states possible. -TEST(CVCItemTest, ConfigureCell) { +TEST_F(CVCItemTest, ConfigureCell) { CVCItem* item = [[CVCItem alloc] initWithType:0]; NSString* instructionsText = @"Instructions Test Text"; NSString* errorMessage = @"Test Error Message";
diff --git a/ios/chrome/browser/ui/autofill/cells/status_item_unittest.mm b/ios/chrome/browser/ui/autofill/cells/status_item_unittest.mm index f6c494b7..ac027650 100644 --- a/ios/chrome/browser/ui/autofill/cells/status_item_unittest.mm +++ b/ios/chrome/browser/ui/autofill/cells/status_item_unittest.mm
@@ -8,6 +8,7 @@ #import "ios/third_party/material_components_ios/src/components/ActivityIndicator/src/MaterialActivityIndicator.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -15,9 +16,11 @@ namespace { +using StatusItemTest = PlatformTest; + // Tests that the cell subviews are set properly after a call to // |configureCell:| in the different states. -TEST(StatusItemTest, ConfigureCell) { +TEST_F(StatusItemTest, ConfigureCell) { StatusItem* item = [[StatusItem alloc] initWithType:0]; NSString* text = @"Test Text"; item.text = text;
diff --git a/ios/chrome/browser/ui/autofill/cells/storage_switch_item_unittest.mm b/ios/chrome/browser/ui/autofill/cells/storage_switch_item_unittest.mm index bb2aed40..d311112 100644 --- a/ios/chrome/browser/ui/autofill/cells/storage_switch_item_unittest.mm +++ b/ios/chrome/browser/ui/autofill/cells/storage_switch_item_unittest.mm
@@ -6,6 +6,7 @@ #include "base/mac/foundation_util.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -13,9 +14,11 @@ namespace { +using StorageSwitchItemTest = PlatformTest; + // Tests that the label and switch values are set properly after a call to // |configureCell:|. -TEST(StorageSwitchItemTest, ConfigureCell) { +TEST_F(StorageSwitchItemTest, ConfigureCell) { StorageSwitchItem* item = [[StorageSwitchItem alloc] initWithType:0]; item.on = YES; @@ -31,7 +34,7 @@ EXPECT_TRUE(switchCell.switchView.on); } -TEST(StorageSwitchItemTest, PrepareForReuseClearsActions) { +TEST_F(StorageSwitchItemTest, PrepareForReuseClearsActions) { StorageSwitchCell* cell = [[StorageSwitchCell alloc] init]; UIButton* tooltipButton = cell.tooltipButton; UISwitch* switchView = cell.switchView;
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_path_cache_unittest.mm b/ios/chrome/browser/ui/bookmarks/bookmark_path_cache_unittest.mm index 24649f49..478e4d1 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_path_cache_unittest.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmark_path_cache_unittest.mm
@@ -5,6 +5,7 @@ #include "ios/chrome/browser/ui/bookmarks/bookmark_path_cache.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -12,7 +13,9 @@ namespace { -TEST(BookmarkPathCacheTest, TestEquality) { +using BookmarkPathCacheTest = PlatformTest; + +TEST_F(BookmarkPathCacheTest, TestEquality) { BookmarkPathCache* cache = [BookmarkPathCache cacheForBookmarkFolder:57 position:200];
diff --git a/ios/chrome/browser/ui/bookmarks/bookmark_position_cache_unittest.mm b/ios/chrome/browser/ui/bookmarks/bookmark_position_cache_unittest.mm index 89d4cd7..acfbf25 100644 --- a/ios/chrome/browser/ui/bookmarks/bookmark_position_cache_unittest.mm +++ b/ios/chrome/browser/ui/bookmarks/bookmark_position_cache_unittest.mm
@@ -5,6 +5,7 @@ #include "ios/chrome/browser/ui/bookmarks/bookmark_position_cache.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -12,7 +13,9 @@ namespace { -TEST(BookmarkPositionCacheTest, TestMenuItemFolderCoding) { +using BookmarkPositionCacheTest = PlatformTest; + +TEST_F(BookmarkPositionCacheTest, TestMenuItemFolderCoding) { BookmarkPositionCache* cache = [BookmarkPositionCache cacheForMenuItemFolderWithPosition:1010101 folderId:6363];
diff --git a/ios/chrome/browser/ui/bookmarks/cells/bookmark_parent_folder_item_unittest.mm b/ios/chrome/browser/ui/bookmarks/cells/bookmark_parent_folder_item_unittest.mm index db831fb..cd6d122 100644 --- a/ios/chrome/browser/ui/bookmarks/cells/bookmark_parent_folder_item_unittest.mm +++ b/ios/chrome/browser/ui/bookmarks/cells/bookmark_parent_folder_item_unittest.mm
@@ -7,6 +7,7 @@ #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -14,7 +15,9 @@ namespace { -TEST(BookmarkParentFolderItemTest, LabelGetsTitle) { +using BookmarkParentFolderItemTest = PlatformTest; + +TEST_F(BookmarkParentFolderItemTest, LabelGetsTitle) { BookmarkParentFolderItem* item = [[BookmarkParentFolderItem alloc] initWithType:0]; BookmarkParentFolderCell* cell =
diff --git a/ios/chrome/browser/ui/bookmarks/cells/bookmark_text_field_item_unittest.mm b/ios/chrome/browser/ui/bookmarks/cells/bookmark_text_field_item_unittest.mm index 2c680bc..239c1ed 100644 --- a/ios/chrome/browser/ui/bookmarks/cells/bookmark_text_field_item_unittest.mm +++ b/ios/chrome/browser/ui/bookmarks/cells/bookmark_text_field_item_unittest.mm
@@ -6,6 +6,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #include "third_party/ocmock/OCMock/OCMock.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -14,7 +15,9 @@ namespace { -TEST(BookmarkTextFieldItemTest, DelegateGetsTextFieldEvents) { +using BookmarkTextFieldItemTest = PlatformTest; + +TEST_F(BookmarkTextFieldItemTest, DelegateGetsTextFieldEvents) { BookmarkTextFieldItem* item = [[BookmarkTextFieldItem alloc] initWithType:0]; BookmarkTextFieldCell* cell = [[BookmarkTextFieldCell alloc] initWithFrame:CGRectZero]; @@ -29,7 +32,7 @@ cell.textField.text = @"Foo"; } -TEST(BookmarkTextFieldItemTest, TextFieldGetsText) { +TEST_F(BookmarkTextFieldItemTest, TextFieldGetsText) { BookmarkTextFieldItem* item = [[BookmarkTextFieldItem alloc] initWithType:0]; BookmarkTextFieldCell* cell = [[BookmarkTextFieldCell alloc] initWithFrame:CGRectZero];
diff --git a/ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrome_unittest.mm b/ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrome_unittest.mm index 471e6f7..97873956 100644 --- a/ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrome_unittest.mm +++ b/ios/chrome/browser/ui/collection_view/cells/MDCCollectionViewCell+Chrome_unittest.mm
@@ -7,6 +7,7 @@ #import "ios/chrome/browser/ui/collection_view/cells/collection_view_footer_item.h" #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -32,7 +33,9 @@ namespace { -TEST(MDCCollectionViewCellChrome, PreferredHeightCallsConfigureCell) { +using MDCCollectionViewCellChrome = PlatformTest; + +TEST_F(MDCCollectionViewCellChrome, PreferredHeightCallsConfigureCell) { FakeCollectionViewItem* item = [[FakeCollectionViewItem alloc] initWithType:0]; item.cellClass = [FakeCollectionViewCell class]; @@ -43,7 +46,7 @@ EXPECT_EQ(1, item.configureCount); } -TEST(MDCCollectionViewCellChrome, PreferredHeight) { +TEST_F(MDCCollectionViewCellChrome, PreferredHeight) { CollectionViewFooterItem* footerItem = [[CollectionViewFooterItem alloc] initWithType:0]; footerItem.text = @"This is a pretty lengthy sentence.";
diff --git a/ios/chrome/browser/ui/collection_view/cells/activity_indicator_cell_unittest.mm b/ios/chrome/browser/ui/collection_view/cells/activity_indicator_cell_unittest.mm index f243a9a..4bd5640 100644 --- a/ios/chrome/browser/ui/collection_view/cells/activity_indicator_cell_unittest.mm +++ b/ios/chrome/browser/ui/collection_view/cells/activity_indicator_cell_unittest.mm
@@ -7,6 +7,7 @@ #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" #import "ios/third_party/material_components_ios/src/components/ActivityIndicator/src/MaterialActivityIndicator.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -14,9 +15,11 @@ namespace { +using ActivityIndicatorItemTest = PlatformTest; + // Tests that when an ActivityIndicatorCell is configured, it has a // MDCActivityIndicator that is animating. -TEST(ActivityIndicatorItemTest, CellDisplaysActivityIndicator) { +TEST_F(ActivityIndicatorItemTest, CellDisplaysActivityIndicator) { CollectionViewItem* item = [[CollectionViewItem alloc] initWithType:0]; item.cellClass = [ActivityIndicatorCell class]; ActivityIndicatorCell* cell =
diff --git a/ios/chrome/browser/ui/collection_view/cells/collection_view_account_item_unittest.mm b/ios/chrome/browser/ui/collection_view/cells/collection_view_account_item_unittest.mm index b729393..27856664 100644 --- a/ios/chrome/browser/ui/collection_view/cells/collection_view_account_item_unittest.mm +++ b/ios/chrome/browser/ui/collection_view/cells/collection_view_account_item_unittest.mm
@@ -9,14 +9,17 @@ #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif +using AccountControlCollectionViewItemTest = PlatformTest; + // Tests that the UIImageView and UILabels are set properly after a call to // |configureCell:|. -TEST(AccountControlCollectionViewItemTest, ImageViewAndTextLabels) { +TEST_F(AccountControlCollectionViewItemTest, ImageViewAndTextLabels) { CollectionViewAccountItem* item = [[CollectionViewAccountItem alloc] initWithType:0]; UIImage* image = [[UIImage alloc] init];
diff --git a/ios/chrome/browser/ui/collection_view/cells/collection_view_detail_item_unittest.mm b/ios/chrome/browser/ui/collection_view/cells/collection_view_detail_item_unittest.mm index 970a3b5..8607b4a 100644 --- a/ios/chrome/browser/ui/collection_view/cells/collection_view_detail_item_unittest.mm +++ b/ios/chrome/browser/ui/collection_view/cells/collection_view_detail_item_unittest.mm
@@ -6,6 +6,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -13,8 +14,10 @@ namespace { +using CollectionViewDetailItemTest = PlatformTest; + // Tests that the UILabels are set properly after a call to |configureCell:|. -TEST(CollectionViewDetailItemTest, TextLabels) { +TEST_F(CollectionViewDetailItemTest, TextLabels) { CollectionViewDetailItem* item = [[CollectionViewDetailItem alloc] initWithType:0]; NSString* mainText = @"Main text"; @@ -35,9 +38,11 @@ EXPECT_NSEQ(detailText, detailCell.detailTextLabel.text); } +using CollectionViewDetailCellTest = PlatformTest; + // Tests that each of the two text labels is provided with the correct amount // of space. -TEST(CollectionViewDetailCellTest, TextLabelTargetWidths) { +TEST_F(CollectionViewDetailCellTest, TextLabelTargetWidths) { // Make the cell 148 wide so that after allocating 3 * kHorizontalPadding (16) // space for the margins and area between the labels, there is 100 available. // Accordingly, in each of the cases below where the sum of the desired label
diff --git a/ios/chrome/browser/ui/collection_view/cells/collection_view_footer_item_unittest.mm b/ios/chrome/browser/ui/collection_view/cells/collection_view_footer_item_unittest.mm index a7711bd..a04dc069 100644 --- a/ios/chrome/browser/ui/collection_view/cells/collection_view_footer_item_unittest.mm +++ b/ios/chrome/browser/ui/collection_view/cells/collection_view_footer_item_unittest.mm
@@ -7,6 +7,7 @@ #import "ios/chrome/browser/ui/collection_view/cells/test_utils.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -14,9 +15,11 @@ namespace { +using CollectionViewFooterItemTest = PlatformTest; + // Tests that the text label and the image are set properly after a call to // |configureCell:|. -TEST(CollectionViewFooterItemTest, ConfigureCell) { +TEST_F(CollectionViewFooterItemTest, ConfigureCell) { CollectionViewFooterItem* item = [[CollectionViewFooterItem alloc] initWithType:0]; NSString* text = @"Test Footer";
diff --git a/ios/chrome/browser/ui/collection_view/cells/collection_view_item_unittest.mm b/ios/chrome/browser/ui/collection_view/cells/collection_view_item_unittest.mm index 2a9534f..fa1fe97c 100644 --- a/ios/chrome/browser/ui/collection_view/cells/collection_view_item_unittest.mm +++ b/ios/chrome/browser/ui/collection_view/cells/collection_view_item_unittest.mm
@@ -8,6 +8,7 @@ #import "ios/third_party/material_components_ios/src/components/CollectionCells/src/MaterialCollectionCells.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -15,7 +16,9 @@ namespace { -TEST(CollectionViewItemTest, Accessors) { +using CollectionViewItemTest = PlatformTest; + +TEST_F(CollectionViewItemTest, Accessors) { CollectionViewItem* five = [[CollectionViewItem alloc] initWithType:5]; CollectionViewItem* twelve = [[CollectionViewItem alloc] initWithType:12]; @@ -30,7 +33,7 @@ EXPECT_EQ(1212, [twelve type]); } -TEST(CollectionViewItemTest, ConfigureCellPortsAccessibilityProperties) { +TEST_F(CollectionViewItemTest, ConfigureCellPortsAccessibilityProperties) { CollectionViewItem* item = [[CollectionViewItem alloc] initWithType:0]; item.accessibilityIdentifier = @"test_identifier"; item.accessibilityTraits = UIAccessibilityTraitButton;
diff --git a/ios/chrome/browser/ui/collection_view/cells/collection_view_switch_item_unittest.mm b/ios/chrome/browser/ui/collection_view/cells/collection_view_switch_item_unittest.mm index 65bb7b4..fbdcb4a 100644 --- a/ios/chrome/browser/ui/collection_view/cells/collection_view_switch_item_unittest.mm +++ b/ios/chrome/browser/ui/collection_view/cells/collection_view_switch_item_unittest.mm
@@ -6,6 +6,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -13,9 +14,11 @@ namespace { +using CollectionViewSwitchItemTest = PlatformTest; + // Tests that the label and switch values are set properly after a call to // |configureCell:|. -TEST(CollectionViewSwitchItemTest, ConfigureCell) { +TEST_F(CollectionViewSwitchItemTest, ConfigureCell) { CollectionViewSwitchItem* item = [[CollectionViewSwitchItem alloc] initWithType:0]; NSString* text = @"Test Switch"; @@ -38,7 +41,7 @@ // Tests that the text color and enabled state of the switch are set correctly // by a call to |configureCell:|. -TEST(CollectionViewSwitchItemTest, EnabledAndDisabled) { +TEST_F(CollectionViewSwitchItemTest, EnabledAndDisabled) { CollectionViewSwitchCell* cell = [[CollectionViewSwitchCell alloc] init]; CollectionViewSwitchItem* item = [[CollectionViewSwitchItem alloc] initWithType:0]; @@ -80,7 +83,7 @@ EXPECT_NSEQ(disabledColor, cell.textLabel.textColor); } -TEST(CollectionViewSwitchItemTest, PrepareForReuseClearsActions) { +TEST_F(CollectionViewSwitchItemTest, PrepareForReuseClearsActions) { CollectionViewSwitchCell* cell = [[CollectionViewSwitchCell alloc] init]; UISwitch* switchView = cell.switchView; NSArray* target = [NSArray array];
diff --git a/ios/chrome/browser/ui/collection_view/cells/collection_view_text_item_unittest.mm b/ios/chrome/browser/ui/collection_view/cells/collection_view_text_item_unittest.mm index 60d49c2..8111772a 100644 --- a/ios/chrome/browser/ui/collection_view/cells/collection_view_text_item_unittest.mm +++ b/ios/chrome/browser/ui/collection_view/cells/collection_view_text_item_unittest.mm
@@ -11,6 +11,7 @@ #import "ios/chrome/browser/ui/collection_view/cells/test_utils.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -18,8 +19,10 @@ namespace { +using CollectionViewTextItemTest = PlatformTest; + // Test that accessory type is copied over to the cell from the item. -TEST(CollectionViewTextItemTest, ConfigureCellPortsAccessoryType) { +TEST_F(CollectionViewTextItemTest, ConfigureCellPortsAccessoryType) { CollectionViewTextItem* item = [[CollectionViewTextItem alloc] initWithType:0]; item.accessoryType = MDCCollectionViewCellAccessoryCheckmark; @@ -31,7 +34,7 @@ } // Test that text properties are copied over to the cell from the item. -TEST(CollectionViewTextItemTest, ConfigureCellPortsTextCellProperties) { +TEST_F(CollectionViewTextItemTest, ConfigureCellPortsTextCellProperties) { CollectionViewTextItem* item = [[CollectionViewTextItem alloc] initWithType:0]; item.text = @"some text"; @@ -47,7 +50,7 @@ // Test that if the item has no accessibilityLabel, the cell gets one composed // of the text and detailText. -TEST(CollectionViewTextItemTest, ConfigureCellDerivesAccessibilityLabel) { +TEST_F(CollectionViewTextItemTest, ConfigureCellDerivesAccessibilityLabel) { CollectionViewTextItem* item = [[CollectionViewTextItem alloc] initWithType:0]; item.text = @"some text"; @@ -61,7 +64,7 @@ // Test that if the item has a non-empty accessibilityLabel, this is copied // over to the cell. -TEST(CollectionViewTextItemTest, ConfigureCellPortsAccessibilityLabel) { +TEST_F(CollectionViewTextItemTest, ConfigureCellPortsAccessibilityLabel) { CollectionViewTextItem* item = [[CollectionViewTextItem alloc] initWithType:0]; item.accessibilityLabel = @"completely different label";
diff --git a/ios/chrome/browser/ui/collection_view/collection_view_model_unittest.mm b/ios/chrome/browser/ui/collection_view/collection_view_model_unittest.mm index 1f1144b..13330136 100644 --- a/ios/chrome/browser/ui/collection_view/collection_view_model_unittest.mm +++ b/ios/chrome/browser/ui/collection_view/collection_view_model_unittest.mm
@@ -11,6 +11,7 @@ #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -64,8 +65,10 @@ // No-op. } +using CollectionViewModelTest = PlatformTest; + // Test generic model boxing (check done at compilation time). -TEST(CollectionViewModelTest, GenericModelBoxing) { +TEST_F(CollectionViewModelTest, GenericModelBoxing) { CollectionViewModel<TestCollectionViewItemSubclass*>* specificModel = [[CollectionViewModel alloc] init]; @@ -76,7 +79,7 @@ generalModel = nil; } -TEST(CollectionViewModelTest, EmptyModel) { +TEST_F(CollectionViewModelTest, EmptyModel) { CollectionViewModel* model = [[CollectionViewModel alloc] init]; // Check there are no items. @@ -87,7 +90,7 @@ EXPECT_EQ(0, [model numberOfSections]); } -TEST(CollectionViewModelTest, SingleSection) { +TEST_F(CollectionViewModelTest, SingleSection) { CollectionViewModel* model = [[CollectionViewModel alloc] init]; [model addSectionWithIdentifier:SectionIdentifierCheese]; @@ -129,7 +132,7 @@ inSection:0]]); } -TEST(CollectionViewModelTest, SingleSectionWithMissingItems) { +TEST_F(CollectionViewModelTest, SingleSectionWithMissingItems) { CollectionViewModel* model = [[CollectionViewModel alloc] init]; [model addSectionWithIdentifier:SectionIdentifierCheese]; @@ -148,7 +151,7 @@ inSection:0]]); } -TEST(CollectionViewModelTest, MultipleSections) { +TEST_F(CollectionViewModelTest, MultipleSections) { CollectionViewModel* model = [[CollectionViewModel alloc] init]; [model addSectionWithIdentifier:SectionIdentifierCheese]; @@ -185,7 +188,7 @@ inSection:1]]); } -TEST(CollectionViewModelTest, GetIndexPathFromModelCoordinates) { +TEST_F(CollectionViewModelTest, GetIndexPathFromModelCoordinates) { CollectionViewModel* model = [[CollectionViewModel alloc] init]; [model addSectionWithIdentifier:SectionIdentifierCheese]; @@ -212,7 +215,7 @@ EXPECT_EQ(0, indexPath.item); } -TEST(CollectionViewItemTest, RepeatedItems) { +TEST_F(CollectionViewModelTest, RepeatedItems) { CollectionViewModel* model = [[CollectionViewModel alloc] init]; [model addSectionWithIdentifier:SectionIdentifierCheese]; @@ -245,7 +248,7 @@ EXPECT_EQ(2, indexPath.item); } -TEST(CollectionViewModelTest, RepeatedItemIndex) { +TEST_F(CollectionViewModelTest, RepeatedItemIndex) { CollectionViewModel* model = [[CollectionViewModel alloc] init]; [model addSectionWithIdentifier:SectionIdentifierCheese]; @@ -280,7 +283,7 @@ inSection:1]]); } -TEST(CollectionViewModelTest, RetrieveAddedItem) { +TEST_F(CollectionViewModelTest, RetrieveAddedItem) { CollectionViewModel* model = [[CollectionViewModel alloc] init]; [model addSectionWithIdentifier:SectionIdentifierCheese]; @@ -293,7 +296,7 @@ inSection:0]]); } -TEST(CollectionViewModelTest, RetrieveItemsInSection) { +TEST_F(CollectionViewModelTest, RetrieveItemsInSection) { CollectionViewModel* model = [[CollectionViewModel alloc] init]; [model addSectionWithIdentifier:SectionIdentifierCheese]; CollectionViewItem* cheddar = @@ -314,7 +317,7 @@ EXPECT_NSEQ(gouda, cheeseItems[2]); } -TEST(CollectionViewModelTest, InvalidIndexPath) { +TEST_F(CollectionViewModelTest, InvalidIndexPath) { CollectionViewModel* model = [[CollectionViewModel alloc] init]; [model addSectionWithIdentifier:SectionIdentifierCheese]; @@ -331,7 +334,7 @@ EXPECT_TRUE(out_of_bounds_exception_thrown); } -TEST(CollectionViewModelTest, RemoveItems) { +TEST_F(CollectionViewModelTest, RemoveItems) { CollectionViewModel* model = [[CollectionViewModel alloc] init]; [model addSectionWithIdentifier:SectionIdentifierCheese]; @@ -383,7 +386,7 @@ EXPECT_EQ(2, indexPath.item); } -TEST(CollectionViewModelTest, RemoveSections) { +TEST_F(CollectionViewModelTest, RemoveSections) { CollectionViewModel* model = [[CollectionViewModel alloc] init]; // Empty section. @@ -415,7 +418,7 @@ EXPECT_EQ(0, [model numberOfSections]); } -TEST(CollectionViewModelTest, QueryItemsFromModelCoordinates) { +TEST_F(CollectionViewModelTest, QueryItemsFromModelCoordinates) { CollectionViewModel* model = [[CollectionViewModel alloc] init]; EXPECT_FALSE([model hasSectionForSectionIdentifier:SectionIdentifierWeasley]); @@ -445,7 +448,7 @@ } // Tests that inserted sections are added at the correct index. -TEST(CollectionViewModelTest, InsertSections) { +TEST_F(CollectionViewModelTest, InsertSections) { CollectionViewModel* model = [[CollectionViewModel alloc] init]; [model addSectionWithIdentifier:SectionIdentifierWeasley]; @@ -465,7 +468,7 @@ } // Tests that inserted items are added at the correct index. -TEST(CollectionViewModelTest, InsertItemAtIndex) { +TEST_F(CollectionViewModelTest, InsertItemAtIndex) { CollectionViewModel* model = [[CollectionViewModel alloc] init]; [model addSectionWithIdentifier:SectionIdentifierCheese]; @@ -500,7 +503,7 @@ EXPECT_EQ(2, goudaIndexPath.item); } -TEST(CollectionViewModelTest, IndexPathsForItems) { +TEST_F(CollectionViewModelTest, IndexPathsForItems) { CollectionViewModel* model = [[CollectionViewModel alloc] init]; [model addSectionWithIdentifier:SectionIdentifierWeasley]; @@ -539,7 +542,7 @@ EXPECT_FALSE([model hasItem:notAddedItem]); } -TEST(CollectionViewModelTest, Headers) { +TEST_F(CollectionViewModelTest, Headers) { CollectionViewModel* model = [[CollectionViewModel alloc] init]; [model addSectionWithIdentifier:SectionIdentifierCheese]; @@ -570,7 +573,7 @@ EXPECT_FALSE([model headerForSection:weasleySection]); } -TEST(CollectionViewModelTest, Footers) { +TEST_F(CollectionViewModelTest, Footers) { CollectionViewModel* model = [[CollectionViewModel alloc] init]; [model addSectionWithIdentifier:SectionIdentifierCheese];
diff --git a/ios/chrome/browser/ui/commands/application_commands.h b/ios/chrome/browser/ui/commands/application_commands.h index 9ddc083..7816bda5 100644 --- a/ios/chrome/browser/ui/commands/application_commands.h +++ b/ios/chrome/browser/ui/commands/application_commands.h
@@ -83,6 +83,9 @@ // Shows the signin UI. - (void)showSignin:(ShowSigninCommand*)command; +// Shows the Add Account UI +- (void)showAddAccount; + @end #endif // IOS_CHROME_BROWSER_UI_COMMANDS_APPLICATION_COMMANDS_H_
diff --git a/ios/chrome/browser/ui/commands/command_dispatcher_unittest.mm b/ios/chrome/browser/ui/commands/command_dispatcher_unittest.mm index ce8511e..1456222 100644 --- a/ios/chrome/browser/ui/commands/command_dispatcher_unittest.mm +++ b/ios/chrome/browser/ui/commands/command_dispatcher_unittest.mm
@@ -10,6 +10,7 @@ #import "ios/chrome/browser/ui/metrics/metrics_recorder.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -153,8 +154,10 @@ #pragma mark - Tests +using CommandDispatcherTest = PlatformTest; + // Tests handler methods with no arguments. -TEST(CommandDispatcherTest, SimpleTarget) { +TEST_F(CommandDispatcherTest, SimpleTarget) { id dispatcher = [[CommandDispatcher alloc] init]; CommandDispatcherTestSimpleTarget* target = [[CommandDispatcherTestSimpleTarget alloc] init]; @@ -173,7 +176,7 @@ } // Tests handler methods that take arguments. -TEST(CommandDispatcherTest, TargetWithArguments) { +TEST_F(CommandDispatcherTest, TargetWithArguments) { id dispatcher = [[CommandDispatcher alloc] init]; CommandDispatcherTestTargetWithArguments* target = [[CommandDispatcherTestTargetWithArguments alloc] init]; @@ -207,7 +210,7 @@ // Tests that messages are routed to the proper handler when multiple targets // are registered. -TEST(CommandDispatcherTest, MultipleTargets) { +TEST_F(CommandDispatcherTest, MultipleTargets) { id dispatcher = [[CommandDispatcher alloc] init]; CommandDispatcherTestSimpleTarget* showTarget = [[CommandDispatcherTestSimpleTarget alloc] init]; @@ -228,7 +231,7 @@ } // Tests handlers registered via protocols. -TEST(CommandDispatcherTest, ProtocolRegistration) { +TEST_F(CommandDispatcherTest, ProtocolRegistration) { id dispatcher = [[CommandDispatcher alloc] init]; CommandDispatcherTestSimpleTarget* target = [[CommandDispatcherTestSimpleTarget alloc] init]; @@ -244,7 +247,7 @@ // Tests that handlers are no longer forwarded messages after selector // deregistration. -TEST(CommandDispatcherTest, SelectorDeregistration) { +TEST_F(CommandDispatcherTest, SelectorDeregistration) { id dispatcher = [[CommandDispatcher alloc] init]; CommandDispatcherTestSimpleTarget* target = [[CommandDispatcherTestSimpleTarget alloc] init]; @@ -274,7 +277,7 @@ // Tests that handlers are no longer forwarded messages after protocol // deregistration. -TEST(CommandDispatcherTest, ProtocolDeregistration) { +TEST_F(CommandDispatcherTest, ProtocolDeregistration) { id dispatcher = [[CommandDispatcher alloc] init]; CommandDispatcherTestSimpleTarget* target = [[CommandDispatcherTestSimpleTarget alloc] init]; @@ -320,7 +323,7 @@ // Tests that handlers are no longer forwarded messages after target // deregistration. -TEST(CommandDispatcherTest, TargetDeregistration) { +TEST_F(CommandDispatcherTest, TargetDeregistration) { id dispatcher = [[CommandDispatcher alloc] init]; CommandDispatcherTestSimpleTarget* showTarget = [[CommandDispatcherTestSimpleTarget alloc] init]; @@ -351,7 +354,7 @@ // Tests that an exception is thrown when there is no registered handler for a // given selector. -TEST(CommandDispatcherTest, NoTargetRegisteredForSelector) { +TEST_F(CommandDispatcherTest, NoTargetRegisteredForSelector) { id dispatcher = [[CommandDispatcher alloc] init]; CommandDispatcherTestSimpleTarget* target = [[CommandDispatcherTestSimpleTarget alloc] init]; @@ -372,7 +375,7 @@ // Tests that -respondsToSelector returns YES for methods once they are // dispatched for. // Tests handler methods with no arguments. -TEST(CommandDispatcherTest, RespondsToSelector) { +TEST_F(CommandDispatcherTest, RespondsToSelector) { id dispatcher = [[CommandDispatcher alloc] init]; EXPECT_FALSE([dispatcher respondsToSelector:@selector(show)]); @@ -395,7 +398,7 @@ // Tests that a registered MetricsRecorder is successfully // notified when commands with no arguments are invoked on the dispatcher. -TEST(CommandDispatcherTest, MetricsRecorderNoArguments) { +TEST_F(CommandDispatcherTest, MetricsRecorderNoArguments) { id dispatcher = [[CommandDispatcher alloc] init]; CommandDispatcherTestSimpleTarget* target = [[CommandDispatcherTestSimpleTarget alloc] init]; @@ -418,7 +421,7 @@ // Tests that a registered MetricsRecorder is successfully // notified when commands with arguments are invoked on the dispatcher. -TEST(CommandDispatcherTest, MetricsRecorderWithArguments) { +TEST_F(CommandDispatcherTest, MetricsRecorderWithArguments) { id dispatcher = [[CommandDispatcher alloc] init]; CommandDispatcherTestTargetWithArguments* target = [[CommandDispatcherTestTargetWithArguments alloc] init]; @@ -460,7 +463,7 @@ // Tests that the correct MetricsRecorders are notified for an invocation // when multiple recorders are registered. -TEST(CommandDispatcherTest, MetricsRecorderMultipleRecorders) { +TEST_F(CommandDispatcherTest, MetricsRecorderMultipleRecorders) { id dispatcher = [[CommandDispatcher alloc] init]; CommandDispatcherTestSimpleTarget* showTarget = [[CommandDispatcherTestSimpleTarget alloc] init]; @@ -490,7 +493,7 @@ // Tests that if a selector registered to a MetricsRecorder is deregistered, // the MetricsRecorder is no longer notified when the selector is invoked on the // dispatcher. -TEST(CommandDispatcherTest, DeregisterMetricsRecorder) { +TEST_F(CommandDispatcherTest, DeregisterMetricsRecorder) { id dispatcher = [[CommandDispatcher alloc] init]; CommandDispatcherTestSimpleTarget* target = [[CommandDispatcherTestSimpleTarget alloc] init];
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_footer_item_unittest.mm b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_footer_item_unittest.mm index 8c1f95ce..65c9fa7 100644 --- a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_footer_item_unittest.mm +++ b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_footer_item_unittest.mm
@@ -5,6 +5,7 @@ #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_footer_item.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #import "third_party/ocmock/OCMock/OCMock.h" #import "third_party/ocmock/gtest_support.h" @@ -14,8 +15,10 @@ namespace { +using ContentSuggestionsFooterItemTest = PlatformTest; + // Tests that configureCell: sets the title of the button and the action. -TEST(ContentSuggestionsFooterItemTest, CellIsConfigured) { +TEST_F(ContentSuggestionsFooterItemTest, CellIsConfigured) { // Setup. NSString* title = @"testTitle"; ContentSuggestionsFooterItem* item = @@ -40,7 +43,7 @@ // Tests that the item is the delegate for the cell, and when the cell button is // tapped, the callback is called. -TEST(ContentSuggestionsFooterItemTest, CellTapped) { +TEST_F(ContentSuggestionsFooterItemTest, CellTapped) { NSString* title = @"testTitle"; __block BOOL hasBeenCalled = NO; __block ContentSuggestionsFooterCell* blockCell = nil;
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_header_item_unittest.mm b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_header_item_unittest.mm index 166f301..69e8de8 100644 --- a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_header_item_unittest.mm +++ b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_header_item_unittest.mm
@@ -5,6 +5,7 @@ #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_header_item.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -12,7 +13,9 @@ namespace { -TEST(ContentSuggestionsHeaderItemTest, CellClass) { +using ContentSuggestionsHeaderItemTest = PlatformTest; + +TEST_F(ContentSuggestionsHeaderItemTest, CellClass) { // Setup. ContentSuggestionsHeaderItem* item = [[ContentSuggestionsHeaderItem alloc] initWithType:0]; @@ -24,7 +27,7 @@ EXPECT_EQ([ContentSuggestionsHeaderCell class], [cell class]); } -TEST(ContentSuggestionsHeaderItemTest, Configure) { +TEST_F(ContentSuggestionsHeaderItemTest, Configure) { // Setup. UIView* view = [[UIView alloc] init]; ContentSuggestionsHeaderItem* item =
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_item_unittest.mm b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_item_unittest.mm index dafd30dc..31085c8 100644 --- a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_item_unittest.mm +++ b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_item_unittest.mm
@@ -8,6 +8,7 @@ #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_cell.h" #include "ios/chrome/grit/ios_strings.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #import "third_party/ocmock/OCMock/OCMock.h" #import "third_party/ocmock/gtest_support.h" #include "ui/base/l10n/l10n_util.h" @@ -19,9 +20,11 @@ namespace { +using ContentSuggestionsItemTest = PlatformTest; + // Tests that configureCell: sets all the fields of the cell except the image // and fetches the image through the delegate. -TEST(ContentSuggestionsItemTest, CellIsConfiguredWithoutImage) { +TEST_F(ContentSuggestionsItemTest, CellIsConfiguredWithoutImage) { // Setup. NSString* title = @"testTitle"; GURL url = GURL("http://chromium.org"); @@ -60,7 +63,7 @@ // Tests that configureCell: does not call the delegate if it fetched the image // once. -TEST(ContentSuggestionsItemTest, DontFetchImageIfImageIsBeingFetched) { +TEST_F(ContentSuggestionsItemTest, DontFetchImageIfImageIsBeingFetched) { // Setup. NSString* title = @"testTitle"; GURL url = GURL("http://chromium.org"); @@ -96,7 +99,7 @@ // Tests that the delegate is not called when |hasImage| is set to NO. If the // delegate is called an exception is raised. -TEST(ContentSuggestionsItemTest, NoDelegateCallWhenHasNotImage) { +TEST_F(ContentSuggestionsItemTest, NoDelegateCallWhenHasNotImage) { // Setup. NSString* title = @"testTitle"; GURL url = GURL("http://chromium.org"); @@ -116,7 +119,7 @@ } // Tests that the display of the image is animated only for the first time. -TEST(ContentSuggestionsItemTest, ImageAnimatedOnlyTheFirstTime) { +TEST_F(ContentSuggestionsItemTest, ImageAnimatedOnlyTheFirstTime) { // Setup. NSString* title = @"testTitle"; GURL url = GURL("http://chromium.org"); @@ -143,7 +146,7 @@ } // Tests the custom actions when there is no read later actions. -TEST(ContentSuggestionsItemTest, NoReadLaterAction) { +TEST_F(ContentSuggestionsItemTest, NoReadLaterAction) { // Setup. NSString* title = @"testTitle"; GURL url = GURL("http://chromium.org");
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_learn_more_item_unittest.mm b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_learn_more_item_unittest.mm index 92cc7a5..bc6f1dcb 100644 --- a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_learn_more_item_unittest.mm +++ b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_learn_more_item_unittest.mm
@@ -5,6 +5,7 @@ #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_learn_more_item.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #import "third_party/ocmock/OCMock/OCMock.h" #import "third_party/ocmock/gtest_support.h" @@ -14,7 +15,9 @@ namespace { -TEST(ContentSuggestionsLearnMoreItemTest, CellClass) { +using ContentSuggestionsLearnMoreItemTest = PlatformTest; + +TEST_F(ContentSuggestionsLearnMoreItemTest, CellClass) { // Setup. ContentSuggestionsLearnMoreItem* item = [[ContentSuggestionsLearnMoreItem alloc] initWithType:0]; @@ -26,7 +29,7 @@ EXPECT_EQ([ContentSuggestionsLearnMoreCell class], [cell class]); } -TEST(ContentSuggestionsLearnMoreItemTest, Configure) { +TEST_F(ContentSuggestionsLearnMoreItemTest, Configure) { // Setup. ContentSuggestionsLearnMoreItem* item = [[ContentSuggestionsLearnMoreItem alloc] initWithType:0];
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_item_unittest.mm b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_item_unittest.mm index 0564dd3..77bdf84 100644 --- a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_item_unittest.mm +++ b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_most_visited_item_unittest.mm
@@ -9,6 +9,7 @@ #import "ios/chrome/browser/ui/favicon/favicon_view.h" #include "ios/chrome/browser/ui/ui_util.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #import "third_party/ocmock/OCMock/OCMock.h" #import "third_party/ocmock/gtest_support.h" @@ -18,7 +19,9 @@ namespace { -TEST(ContentSuggestionsMostVisitedItemTest, CellClass) { +using ContentSuggestionsMostVisitedItemTest = PlatformTest; + +TEST_F(ContentSuggestionsMostVisitedItemTest, CellClass) { // Setup. ContentSuggestionsMostVisitedItem* item = [[ContentSuggestionsMostVisitedItem alloc] initWithType:0]; @@ -30,7 +33,7 @@ ASSERT_EQ([ContentSuggestionsMostVisitedCell class], [cell class]); } -TEST(ContentSuggestionsMostVisitedItemTest, Configure) { +TEST_F(ContentSuggestionsMostVisitedItemTest, Configure) { // Setup. NSString* title = @"Test title."; ContentSuggestionsMostVisitedItem* item =
diff --git a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_whats_new_item_unittest.mm b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_whats_new_item_unittest.mm index 9ca5ab7..9c897bf 100644 --- a/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_whats_new_item_unittest.mm +++ b/ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_whats_new_item_unittest.mm
@@ -5,6 +5,7 @@ #import "ios/chrome/browser/ui/content_suggestions/cells/content_suggestions_whats_new_item.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #import "third_party/ocmock/OCMock/OCMock.h" #import "third_party/ocmock/gtest_support.h" @@ -14,7 +15,9 @@ namespace { -TEST(ContentSuggestionsWhatsNewItemTest, CellClass) { +using ContentSuggestionsWhatsNewItemTest = PlatformTest; + +TEST_F(ContentSuggestionsWhatsNewItemTest, CellClass) { // Setup. ContentSuggestionsWhatsNewItem* item = [[ContentSuggestionsWhatsNewItem alloc] initWithType:0]; @@ -26,7 +29,7 @@ EXPECT_EQ([ContentSuggestionsWhatsNewCell class], [cell class]); } -TEST(ContentSuggestionsWhatsNewItemTest, Configure) { +TEST_F(ContentSuggestionsWhatsNewItemTest, Configure) { // Setup. UIImage* image = [[UIImage alloc] init]; NSString* text = @"What's new test!";
diff --git a/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater_unittest.mm b/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater_unittest.mm index 00fe81b..273fd0c 100644 --- a/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater_unittest.mm +++ b/ios/chrome/browser/ui/content_suggestions/content_suggestions_collection_updater_unittest.mm
@@ -22,7 +22,9 @@ namespace { -TEST(ContentSuggestionsCollectionUpdaterTest, addEmptyItemToEmptySection) { +using ContentSuggestionsCollectionUpdaterTest = PlatformTest; + +TEST_F(ContentSuggestionsCollectionUpdaterTest, addEmptyItemToEmptySection) { // Setup. NSString* emptyString = @"test empty"; id mockDataSource = OCMProtocolMock(@protocol(ContentSuggestionsDataSource)); @@ -59,8 +61,8 @@ EXPECT_EQ(emptyString, item.detailText); } -TEST(ContentSuggestionsCollectionUpdaterTest, - addEmptyItemToSectionWithoutText) { +TEST_F(ContentSuggestionsCollectionUpdaterTest, + addEmptyItemToSectionWithoutText) { // Setup. id mockDataSource = OCMProtocolMock(@protocol(ContentSuggestionsDataSource)); ContentSuggestionsCollectionUpdater* updater = @@ -92,7 +94,7 @@ ASSERT_EQ(0, [model numberOfItemsInSection:0]); } -TEST(ContentSuggestionsCollectionUpdaterTest, addEmptyItemToSection) { +TEST_F(ContentSuggestionsCollectionUpdaterTest, addEmptyItemToSection) { // Setup. id mockDataSource = OCMProtocolMock(@protocol(ContentSuggestionsDataSource)); ContentSuggestionsCollectionUpdater* updater =
diff --git a/ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion_identifier_unittest.mm b/ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion_identifier_unittest.mm index c6c4148..e86afef 100644 --- a/ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion_identifier_unittest.mm +++ b/ios/chrome/browser/ui/content_suggestions/identifier/content_suggestion_identifier_unittest.mm
@@ -6,6 +6,7 @@ #import "ios/chrome/browser/ui/content_suggestions/identifier/content_suggestions_section_information.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -17,8 +18,10 @@ @implementation ContentSuggestionIdentifierSubclassTest @end +using ContentSuggestionIdentifierTest = PlatformTest; + // Tests different equality scenario. -TEST(ContentSuggestionIdentifierTest, IsEquals) { +TEST_F(ContentSuggestionIdentifierTest, IsEquals) { // Setup. std::string id1("identifier"); std::string id2("identifier"); @@ -48,7 +51,7 @@ } // Test non-equality between different objects. -TEST(ContentSuggestionIdentifierTest, IsNotEqualsDifferentObjects) { +TEST_F(ContentSuggestionIdentifierTest, IsNotEqualsDifferentObjects) { // Setup. NSObject* object = [[NSObject alloc] init]; ContentSuggestionIdentifier* suggestionIdentifier = @@ -59,7 +62,7 @@ } // Test non-equality. -TEST(ContentSuggestionIdentifierTest, IsNotEquals) { +TEST_F(ContentSuggestionIdentifierTest, IsNotEquals) { // Setup. std::string id1("identifier"); std::string id2("identifier2");
diff --git a/ios/chrome/browser/ui/contextual_search/touch_to_search_permissions_mediator_unittest.mm b/ios/chrome/browser/ui/contextual_search/touch_to_search_permissions_mediator_unittest.mm index d1d3b5c..2e4055d7 100644 --- a/ios/chrome/browser/ui/contextual_search/touch_to_search_permissions_mediator_unittest.mm +++ b/ios/chrome/browser/ui/contextual_search/touch_to_search_permissions_mediator_unittest.mm
@@ -526,7 +526,9 @@ #pragma mark - Unit tests for availability class method. -TEST(TouchToSearchPermissionsAvailabilityTest, CommandLinePermissions) { +using TouchToSearchPermissionsAvailabilityTest = PlatformTest; + +TEST_F(TouchToSearchPermissionsAvailabilityTest, CommandLinePermissions) { const struct { bool set_disable; bool set_enable; @@ -555,7 +557,7 @@ } } -TEST(TouchToSearchPermissionsAvailabilityTest, FieldTrial) { +TEST_F(TouchToSearchPermissionsAvailabilityTest, FieldTrial) { // Field trial support is not currently supported, so it is expected // that under all field trial configs, the feature will remain disabled. // If field trial support is added back in, this test should be updated. @@ -586,7 +588,9 @@ #pragma mark - Unit tests for mock class -TEST(MockTouchToSearchPermissionsTest, Mocking) { +using MockTouchToSearchPermissionsTest = PlatformTest; + +TEST_F(MockTouchToSearchPermissionsTest, Mocking) { MockTouchToSearchPermissionsMediator* scoped_permissions = [[MockTouchToSearchPermissionsMediator alloc] initWithBrowserState:nullptr];
diff --git a/ios/chrome/browser/ui/dialogs/nsurl_protection_space_util_unittest.mm b/ios/chrome/browser/ui/dialogs/nsurl_protection_space_util_unittest.mm index 1502ebf..fd5f912 100644 --- a/ios/chrome/browser/ui/dialogs/nsurl_protection_space_util_unittest.mm +++ b/ios/chrome/browser/ui/dialogs/nsurl_protection_space_util_unittest.mm
@@ -55,8 +55,10 @@ } // namespace +using NSURLProtectionSpaceUtilTest = PlatformTest; + // Tests that dialog can not be shown without valid host. -TEST(NSURLProtectionSpaceUtilTest, CantShowWithoutValidHost) { +TEST_F(NSURLProtectionSpaceUtilTest, CantShowWithoutValidHost) { NSURLProtectionSpace* protectionSpace = GetProtectionSpaceForHost(@"", NSURLProtectionSpaceHTTPS); @@ -64,7 +66,7 @@ } // Tests that dialog can not be shown with invalid port. -TEST(NSURLProtectionSpaceUtilTest, CantShowWithoutValidPort) { +TEST_F(NSURLProtectionSpaceUtilTest, CantShowWithoutValidPort) { NSURLProtectionSpace* protectionSpace = GetProtectionSpaceForHost(kTestHost, NSURLProtectionSpaceHTTPS, INT_MAX); @@ -72,7 +74,7 @@ } // Tests showing the dialog for SOCKS proxy server. -TEST(NSURLProtectionSpaceUtilTest, ShowForSocksProxy) { +TEST_F(NSURLProtectionSpaceUtilTest, ShowForSocksProxy) { NSURLProtectionSpace* protectionSpace = GetProtectionSpaceForProxyHost(kTestHost, NSURLProtectionSpaceSOCKSProxy); @@ -93,7 +95,7 @@ } // Tests showing the dialog for http proxy server. -TEST(NSURLProtectionSpaceUtilTest, ShowForHttpProxy) { +TEST_F(NSURLProtectionSpaceUtilTest, ShowForHttpProxy) { NSURLProtectionSpace* protectionSpace = GetProtectionSpaceForProxyHost(kTestHost, NSURLProtectionSpaceHTTPProxy); @@ -113,7 +115,7 @@ } // Tests showing the dialog for https proxy server. -TEST(NSURLProtectionSpaceUtilTest, ShowForHttpsProxy) { +TEST_F(NSURLProtectionSpaceUtilTest, ShowForHttpsProxy) { NSURLProtectionSpace* protectionSpace = GetProtectionSpaceForProxyHost(kTestHost, NSURLProtectionSpaceHTTPSProxy); @@ -144,7 +146,7 @@ } // Tests showing the dialog for http server. -TEST(NSURLProtectionSpaceUtilTest, ShowForHttpServer) { +TEST_F(NSURLProtectionSpaceUtilTest, ShowForHttpServer) { NSURLProtectionSpace* protectionSpace = GetProtectionSpaceForHost(kTestHost, NSURLProtectionSpaceHTTP); @@ -163,7 +165,7 @@ } // Tests showing the dialog for https server. -TEST(NSURLProtectionSpaceUtilTest, ShowForHttpsServer) { +TEST_F(NSURLProtectionSpaceUtilTest, ShowForHttpsServer) { NSURLProtectionSpace* protectionSpace = GetProtectionSpaceForHost(kTestHost, NSURLProtectionSpaceHTTPS);
diff --git a/ios/chrome/browser/ui/elements/activity_overlay_coordinator_unittest.mm b/ios/chrome/browser/ui/elements/activity_overlay_coordinator_unittest.mm index 55d31d6..e5a772c 100644 --- a/ios/chrome/browser/ui/elements/activity_overlay_coordinator_unittest.mm +++ b/ios/chrome/browser/ui/elements/activity_overlay_coordinator_unittest.mm
@@ -8,14 +8,17 @@ #import "ios/chrome/browser/ui/elements/activity_overlay_view_controller.h" #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif +using ActivityOverlayCoordinatorTest = PlatformTest; + // Tests that invoking start and stop on the coordinator presents and dismisses // the activity overlay view, respectively. -TEST(ActivityOverlayCoordinatorTest, StartAndStop) { +TEST_F(ActivityOverlayCoordinatorTest, StartAndStop) { __weak UIView* overlay_view; @autoreleasepool { UIViewController* base_view_controller = [[UIViewController alloc] init];
diff --git a/ios/chrome/browser/ui/elements/selector_coordinator_unittest.mm b/ios/chrome/browser/ui/elements/selector_coordinator_unittest.mm index 7ba092d..a29310a 100644 --- a/ios/chrome/browser/ui/elements/selector_coordinator_unittest.mm +++ b/ios/chrome/browser/ui/elements/selector_coordinator_unittest.mm
@@ -9,6 +9,7 @@ #import "ios/chrome/browser/ui/elements/selector_view_controller_delegate.h" #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" +#include "testing/platform_test.h" #include "third_party/ocmock/OCMock/OCMock.h" #include "third_party/ocmock/gtest_support.h" @@ -22,9 +23,11 @@ @property SelectorPickerViewController* selectorPickerViewController; @end +using SelectorCoordinatorTest = PlatformTest; + // Tests that invoking start on the coordinator presents the selector view, and // that invoking stop dismisses the view and invokes the delegate. -TEST(SelectorCoordinatorTest, StartAndStop) { +TEST_F(SelectorCoordinatorTest, StartAndStop) { UIWindow* keyWindow = [[UIApplication sharedApplication] keyWindow]; UIViewController* rootViewController = keyWindow.rootViewController; SelectorCoordinator* coordinator = [[SelectorCoordinator alloc] @@ -47,7 +50,7 @@ // Tests that calling the view controller delegate method invokes the // SelectorCoordinatorDelegate method and stops the coordinator. -TEST(SelectorCoordinatorTest, Delegate) { +TEST_F(SelectorCoordinatorTest, Delegate) { UIWindow* keyWindow = [[UIApplication sharedApplication] keyWindow]; UIViewController* rootViewController = keyWindow.rootViewController; SelectorCoordinator* coordinator = [[SelectorCoordinator alloc]
diff --git a/ios/chrome/browser/ui/elements/selector_picker_view_controller_unittest.mm b/ios/chrome/browser/ui/elements/selector_picker_view_controller_unittest.mm index e88d38f6..579b209 100644 --- a/ios/chrome/browser/ui/elements/selector_picker_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/elements/selector_picker_view_controller_unittest.mm
@@ -8,6 +8,7 @@ #import "ios/chrome/browser/ui/elements/selector_view_controller_delegate.h" #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" +#include "testing/platform_test.h" #include "third_party/ocmock/OCMock/OCMock.h" #include "third_party/ocmock/gtest_support.h" @@ -22,9 +23,11 @@ @property(nonatomic, retain) UIPickerView* pickerView; @end +using SelectorPickerViewControllerTest = PlatformTest; + // Test that invoking the right bar button action ("Done") invokes the delegate // callback with the appropriate selected item. -TEST(SelectorPickerViewControllerTest, Done) { +TEST_F(SelectorPickerViewControllerTest, Done) { NSString* option1 = @"Option 1"; NSString* option2 = @"Option 2"; NSOrderedSet<NSString*>* options = @@ -56,7 +59,7 @@ // Test that invoking the right bar button action ("Cancel") invokes the // delegate callback with the default item. -TEST(SelectorPickerViewControllerTest, Cancel) { +TEST_F(SelectorPickerViewControllerTest, Cancel) { NSString* option1 = @"Option 1"; NSString* option2 = @"Option 2"; NSOrderedSet<NSString*>* options = @@ -87,7 +90,7 @@ // Test that the picker view is styled appropriately based on parameters // provided at initialization. -TEST(SelectorPickerViewControllerTest, DefaultStyling) { +TEST_F(SelectorPickerViewControllerTest, DefaultStyling) { NSString* option1 = @"Option 1"; NSString* option2 = @"Option 2"; NSString* option3 = @"Option 3";
diff --git a/ios/chrome/browser/ui/first_run/first_run_util_unittest.mm b/ios/chrome/browser/ui/first_run/first_run_util_unittest.mm index 50c7820..ed8fb02 100644 --- a/ios/chrome/browser/ui/first_run/first_run_util_unittest.mm +++ b/ios/chrome/browser/ui/first_run/first_run_util_unittest.mm
@@ -6,6 +6,7 @@ #include "ios/chrome/browser/ui/first_run/first_run_util.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -13,7 +14,9 @@ namespace { -TEST(UICommonTest, TestFixOrphanWord) { +using UICommonTest = PlatformTest; + +TEST_F(UICommonTest, TestFixOrphanWord) { NSString* englishString = @"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec tempus" " dignissim congue. Morbi pulvinar vitae purus at mollis. Sed laoreet "
diff --git a/ios/chrome/browser/ui/history/history_entries_status_item_unittest.mm b/ios/chrome/browser/ui/history/history_entries_status_item_unittest.mm index 26b93d51..d72a38dc8 100644 --- a/ios/chrome/browser/ui/history/history_entries_status_item_unittest.mm +++ b/ios/chrome/browser/ui/history/history_entries_status_item_unittest.mm
@@ -13,6 +13,7 @@ #include "ios/chrome/grit/ios_strings.h" #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" +#include "testing/platform_test.h" #include "third_party/ocmock/OCMock/OCMock.h" #include "third_party/ocmock/gtest_support.h" #include "ui/base/l10n/l10n_util.h" @@ -46,10 +47,12 @@ namespace { +using HistoryEntriesStatusItemTest = PlatformTest; + // Tests that configuring a cell for HistoryEntriesStatusItem with hidden // property set to YES results in an empty label, regardless of what // showsOtherBrowsingDataNotice is set to. -TEST(HistoryEntriesStatusItemTest, TestHidden) { +TEST_F(HistoryEntriesStatusItemTest, TestHidden) { HistoryEntriesStatusItem* item = [[HistoryEntriesStatusItem alloc] initWithType:0]; item.hidden = YES; @@ -62,7 +65,7 @@ // Tests that configuring a cell for HistoryEntriesStatusItem with // showsOtherBrowsingDataNotice set to YES adds other browsing // data text to the label, while set to NO has no text. -TEST(HistoryEntriesStatusItemTest, TestOtherBrowsingDataNotice) { +TEST_F(HistoryEntriesStatusItemTest, TestOtherBrowsingDataNotice) { HistoryEntriesStatusItem* item = [[HistoryEntriesStatusItem alloc] initWithType:0]; HistoryEntriesStatusCell* cell = [[HistoryEntriesStatusCell alloc] init]; @@ -82,7 +85,7 @@ // Tests that tapping on links on a configured cell invokes // the HistoryEntriesStatusItemDelegate method. -TEST(HistoryEntriesStatusItemTest, TestDelegate) { +TEST_F(HistoryEntriesStatusItemTest, TestDelegate) { HistoryEntriesStatusItem* item = [[HistoryEntriesStatusItem alloc] initWithType:0]; HistoryEntriesStatusCell* cell = [[HistoryEntriesStatusCell alloc] init];
diff --git a/ios/chrome/browser/ui/history/history_entry_item_unittest.mm b/ios/chrome/browser/ui/history/history_entry_item_unittest.mm index eacffdf1..1d2c052 100644 --- a/ios/chrome/browser/ui/history/history_entry_item_unittest.mm +++ b/ios/chrome/browser/ui/history/history_entry_item_unittest.mm
@@ -11,6 +11,7 @@ #include "components/history/core/browser/browsing_history_service.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -37,10 +38,12 @@ return item; } +using HistoryEntryItemTest = PlatformTest; + // Tests that -[HistoryEntryItem configureCell:] sets the cell's textLabel text // to the item title, the detailTextLabel text to the URL, and the timeLabel // text to the timestamp. -TEST(HistoryEntryItemTest, ConfigureCell) { +TEST_F(HistoryEntryItemTest, ConfigureCell) { base::Time timestamp = base::Time::Now(); HistoryEntryItem* item = GetHistoryEntryItem(GURL(kTestUrl), kTestTitle, timestamp); @@ -56,7 +59,7 @@ // Tests that -[HistoryItem isEqualToHistoryItem:] returns YES if the two items // have the same URL and timestamp, and NO otherwise. -TEST(HistoryEntryItemTest, IsEqual) { +TEST_F(HistoryEntryItemTest, IsEqual) { base::Time timestamp = base::Time::Now(); base::Time timestamp2 = timestamp - base::TimeDelta::FromMinutes(1); HistoryEntryItem* history_entry =
diff --git a/ios/chrome/browser/ui/icons/chrome_icon_unittest.mm b/ios/chrome/browser/ui/icons/chrome_icon_unittest.mm index 8ea5bc9..e9e97df 100644 --- a/ios/chrome/browser/ui/icons/chrome_icon_unittest.mm +++ b/ios/chrome/browser/ui/icons/chrome_icon_unittest.mm
@@ -6,6 +6,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #import "third_party/ocmock/OCMock/OCMock.h" #import "third_party/ocmock/ocmock_extensions.h" #include "ui/base/l10n/l10n_util_mac.h" @@ -20,14 +21,16 @@ namespace { -TEST(ChromeIconTest, NonNilIcons) { +using ChromeIconTest = PlatformTest; + +TEST_F(ChromeIconTest, NonNilIcons) { EXPECT_TRUE([ChromeIcon backIcon]); EXPECT_TRUE([ChromeIcon closeIcon]); EXPECT_TRUE([ChromeIcon infoIcon]); EXPECT_TRUE([ChromeIcon searchIcon]); } -TEST(ChromeIconTest, Accessibility) { +TEST_F(ChromeIconTest, Accessibility) { EXPECT_TRUE([ChromeIcon backIcon].accessibilityIdentifier); EXPECT_TRUE([ChromeIcon backIcon].accessibilityLabel); @@ -41,12 +44,12 @@ EXPECT_TRUE([ChromeIcon searchIcon].accessibilityLabel); } -TEST(ChromeIcontTest, RTL) { +TEST_F(ChromeIconTest, RTL) { EXPECT_TRUE([ChromeIcon backIcon].flipsForRightToLeftLayoutDirection); EXPECT_FALSE([ChromeIcon searchIcon].flipsForRightToLeftLayoutDirection); } -TEST(ChromeIconTest, TemplateBarButtonItem) { +TEST_F(ChromeIconTest, TemplateBarButtonItem) { UIImage* image = [UIImage imageNamed:@"ic_close"]; image.accessibilityIdentifier = @"identifier"; image.accessibilityLabel = @"label";
diff --git a/ios/chrome/browser/ui/key_commands_provider_unittest.mm b/ios/chrome/browser/ui/key_commands_provider_unittest.mm index 7d0d0a2..240aa663 100644 --- a/ios/chrome/browser/ui/key_commands_provider_unittest.mm +++ b/ios/chrome/browser/ui/key_commands_provider_unittest.mm
@@ -18,7 +18,9 @@ typedef PlatformTest KeyCommandsProviderTest; -TEST(KeyCommandsProviderTest, NoTabs_EditingText_ReturnsObjects) { +using KeyCommandsProviderTest = PlatformTest; + +TEST_F(KeyCommandsProviderTest, NoTabs_EditingText_ReturnsObjects) { KeyCommandsProvider* provider = [[KeyCommandsProvider alloc] init]; id mockConsumer = [OCMockObject mockForProtocol:@protocol(KeyCommandsPlumbing)]; @@ -30,7 +32,7 @@ editingText:YES]); } -TEST(KeyCommandsProviderTest, ReturnsKeyCommandsObjects) { +TEST_F(KeyCommandsProviderTest, ReturnsKeyCommandsObjects) { KeyCommandsProvider* provider = [[KeyCommandsProvider alloc] init]; id mockConsumer = [OCMockObject mockForProtocol:@protocol(KeyCommandsPlumbing)]; @@ -45,7 +47,7 @@ } } -TEST(KeyCommandsProviderTest, MoreKeyboardCommandsWhenTabs) { +TEST_F(KeyCommandsProviderTest, MoreKeyboardCommandsWhenTabs) { KeyCommandsProvider* provider = [[KeyCommandsProvider alloc] init]; id mockConsumer = [OCMockObject mockForProtocol:@protocol(KeyCommandsPlumbing)]; @@ -68,7 +70,7 @@ EXPECT_GT(numberOfKeyCommandsWithTabs, numberOfKeyCommandsWithoutTabs); } -TEST(KeyCommandsProviderTest, LessKeyCommandsWhenTabsAndEditingText) { +TEST_F(KeyCommandsProviderTest, LessKeyCommandsWhenTabsAndEditingText) { KeyCommandsProvider* provider = [[KeyCommandsProvider alloc] init]; id mockConsumer = [OCMockObject mockForProtocol:@protocol(KeyCommandsPlumbing)];
diff --git a/ios/chrome/browser/ui/keyboard/UIKeyCommand+Chrome.h b/ios/chrome/browser/ui/keyboard/UIKeyCommand+Chrome.h index bffa1eb..33197be 100644 --- a/ios/chrome/browser/ui/keyboard/UIKeyCommand+Chrome.h +++ b/ios/chrome/browser/ui/keyboard/UIKeyCommand+Chrome.h
@@ -28,14 +28,6 @@ @end typedef void (^UIKeyCommandAction)(void); -typedef void (^ChromeCommandBlock)(NSInteger); - -// Returns an autoreleased block that sends a |chromeExecuteCommand:| message to -// |responder| by passing a GenericChromeCommand. The tag for the -// GenericChromeCommand is the argument to pass to the block. -// Note that |responder| will not be retained by the block, so it's safe to -// pass |self|, for example. -ChromeCommandBlock ChromeCommandBlockWithResponder(UIResponder* responder); // Addition to the set of predefined modifier flags. extern UIKeyModifierFlags Cr_UIKeyModifierNone;
diff --git a/ios/chrome/browser/ui/keyboard/UIKeyCommand+Chrome.mm b/ios/chrome/browser/ui/keyboard/UIKeyCommand+Chrome.mm index cbbddca..e080345 100644 --- a/ios/chrome/browser/ui/keyboard/UIKeyCommand+Chrome.mm +++ b/ios/chrome/browser/ui/keyboard/UIKeyCommand+Chrome.mm
@@ -6,21 +6,10 @@ #import <objc/runtime.h> -#import "ios/chrome/browser/ui/commands/UIKit+ChromeExecuteCommand.h" -#import "ios/chrome/browser/ui/commands/generic_chrome_command.h" - #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif -ChromeCommandBlock ChromeCommandBlockWithResponder(UIResponder* responder) { - __weak UIResponder* weakResponder = responder; - return [^(NSInteger tag) { - [weakResponder - chromeExecuteCommand:[GenericChromeCommand commandWithTag:tag]]; - } copy]; -} - UIKeyModifierFlags Cr_UIKeyModifierNone = 0; @implementation UIApplication (ChromeKeyCommandHandler)
diff --git a/ios/chrome/browser/ui/keyboard/UIKeyCommand+ChromeTest.mm b/ios/chrome/browser/ui/keyboard/UIKeyCommand+ChromeTest.mm index 311e425..3aa9a28 100644 --- a/ios/chrome/browser/ui/keyboard/UIKeyCommand+ChromeTest.mm +++ b/ios/chrome/browser/ui/keyboard/UIKeyCommand+ChromeTest.mm
@@ -6,6 +6,7 @@ #include "base/mac/scoped_nsobject.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -13,9 +14,11 @@ namespace { +using UIKeyCommandChromeTest = PlatformTest; + // Tests that UIApplication correctly calls the keyboard command action block // when invoked. -TEST(UIKeyCommandChromeTest, UIApplicationHandleKeyCommand_CallsBlock) { +TEST_F(UIKeyCommandChromeTest, UIApplicationHandleKeyCommand_CallsBlock) { __block BOOL called = NO; UIKeyCommand* command = [UIKeyCommand cr_keyCommandWithInput:@""
diff --git a/ios/chrome/browser/ui/main/main_coordinator_unittest.mm b/ios/chrome/browser/ui/main/main_coordinator_unittest.mm index e7fa0fa..c48ad69 100644 --- a/ios/chrome/browser/ui/main/main_coordinator_unittest.mm +++ b/ios/chrome/browser/ui/main/main_coordinator_unittest.mm
@@ -8,12 +8,15 @@ #include "ios/chrome/browser/ui/main/main_view_controller.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif -TEST(MainCoordinatorTest, SizeViewController) { +using MainCoordinatorTest = PlatformTest; + +TEST_F(MainCoordinatorTest, SizeViewController) { CGRect rect = [UIScreen mainScreen].bounds; UIWindow* window = [UIApplication sharedApplication].keyWindow; MainCoordinator* coordinator =
diff --git a/ios/chrome/browser/ui/native_content_controller_unittest.mm b/ios/chrome/browser/ui/native_content_controller_unittest.mm index e581f25..ff75e3c3 100644 --- a/ios/chrome/browser/ui/native_content_controller_unittest.mm +++ b/ios/chrome/browser/ui/native_content_controller_unittest.mm
@@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/logging.h" #import "ios/chrome/browser/ui/native_content_controller.h" +#include "base/logging.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #include "url/gurl.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -13,7 +14,9 @@ namespace { -TEST(NativeContentControllerTest, TestInitWithURL) { +using NativeContentControllerTest = PlatformTest; + +TEST_F(NativeContentControllerTest, TestInitWithURL) { GURL url("http://foo.bar.com"); NativeContentController* controller = [[NativeContentController alloc] initWithURL:url]; @@ -23,7 +26,7 @@ EXPECT_EQ(nil, controller.view); } -TEST(NativeContentControllerTest, TestInitWithEmptyNibNameAndURL) { +TEST_F(NativeContentControllerTest, TestInitWithEmptyNibNameAndURL) { GURL url("http://foo.bar.com"); NativeContentController* controller = [[NativeContentController alloc] initWithNibName:nil url:url]; @@ -33,7 +36,7 @@ EXPECT_EQ(nil, controller.view); } -TEST(NativeContentControllerTest, TestInitWithNibAndURL) { +TEST_F(NativeContentControllerTest, TestInitWithNibAndURL) { GURL url("http://foo.bar.com"); NSString* nibName = @"native_content_controller_test"; NativeContentController* controller =
diff --git a/ios/chrome/browser/ui/page_not_available_controller_unittest.mm b/ios/chrome/browser/ui/page_not_available_controller_unittest.mm index 6c22136..a699a95 100644 --- a/ios/chrome/browser/ui/page_not_available_controller_unittest.mm +++ b/ios/chrome/browser/ui/page_not_available_controller_unittest.mm
@@ -2,17 +2,21 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <gtest/gtest.h> -#include "base/logging.h" #import "ios/chrome/browser/ui/page_not_available_controller.h" +#include "base/logging.h" +#include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" + #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif namespace { -TEST(PageNotAvailableControllerTest, TestInitWithURL) { +using PageNotAvailableControllerTest = PlatformTest; + +TEST_F(PageNotAvailableControllerTest, TestInitWithURL) { GURL url = GURL("http://foo.bar.com"); PageNotAvailableController* controller = [[PageNotAvailableController alloc] initWithUrl:url];
diff --git a/ios/chrome/browser/ui/payments/cells/accepted_payment_methods_item_unittest.mm b/ios/chrome/browser/ui/payments/cells/accepted_payment_methods_item_unittest.mm index 0d736ce..5f2d3199 100644 --- a/ios/chrome/browser/ui/payments/cells/accepted_payment_methods_item_unittest.mm +++ b/ios/chrome/browser/ui/payments/cells/accepted_payment_methods_item_unittest.mm
@@ -7,6 +7,7 @@ #import "ios/chrome/browser/ui/collection_view/cells/test_utils.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -14,9 +15,11 @@ namespace { +using PaymentRequestAcceptedPaymentMethodsItemTest = PlatformTest; + // Tests that the label and the images are set properly after a call to // |configureCell:|. -TEST(PaymentRequestAcceptedPaymentMethodsItemTest, TextLabelsAndImages) { +TEST_F(PaymentRequestAcceptedPaymentMethodsItemTest, TextLabelsAndImages) { AcceptedPaymentMethodsItem* item = [[AcceptedPaymentMethodsItem alloc] init]; NSString* message = @"Lorem ipsum dolor sit amet";
diff --git a/ios/chrome/browser/ui/payments/cells/autofill_profile_item_unittest.mm b/ios/chrome/browser/ui/payments/cells/autofill_profile_item_unittest.mm index 207cfa9..18f71bd 100644 --- a/ios/chrome/browser/ui/payments/cells/autofill_profile_item_unittest.mm +++ b/ios/chrome/browser/ui/payments/cells/autofill_profile_item_unittest.mm
@@ -7,6 +7,7 @@ #import "ios/chrome/browser/ui/collection_view/cells/test_utils.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -14,8 +15,10 @@ namespace { +using PaymentRequestAutofillProfileItemTest = PlatformTest; + // Tests that the labels are set properly after a call to |configureCell:|. -TEST(PaymentRequestAutofillProfileItemTest, TextLabels) { +TEST_F(PaymentRequestAutofillProfileItemTest, TextLabels) { AutofillProfileItem* item = [[AutofillProfileItem alloc] init]; NSString* name = @"Jon Doe";
diff --git a/ios/chrome/browser/ui/payments/cells/page_info_item_unittest.mm b/ios/chrome/browser/ui/payments/cells/page_info_item_unittest.mm index cf8e1d5..b82cb6fc 100644 --- a/ios/chrome/browser/ui/payments/cells/page_info_item_unittest.mm +++ b/ios/chrome/browser/ui/payments/cells/page_info_item_unittest.mm
@@ -7,6 +7,7 @@ #import "ios/chrome/browser/ui/collection_view/cells/test_utils.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -14,9 +15,11 @@ namespace { +using PaymentRequestPageInfoItemTest = PlatformTest; + // Tests that the labels and image are set properly after a call to // |configureCell:|. -TEST(PaymentRequestPageInfoItemTest, TextLabels) { +TEST_F(PaymentRequestPageInfoItemTest, TextLabels) { PageInfoItem* item = [[PageInfoItem alloc] init]; UIImage* pageFavicon = CollectionViewTestImage();
diff --git a/ios/chrome/browser/ui/payments/cells/payment_method_item_unittest.mm b/ios/chrome/browser/ui/payments/cells/payment_method_item_unittest.mm index d3895f2..91be9db0 100644 --- a/ios/chrome/browser/ui/payments/cells/payment_method_item_unittest.mm +++ b/ios/chrome/browser/ui/payments/cells/payment_method_item_unittest.mm
@@ -7,6 +7,7 @@ #import "ios/chrome/browser/ui/collection_view/cells/test_utils.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -14,9 +15,11 @@ namespace { +using PaymentRequestPaymentMethodItemTest = PlatformTest; + // Tests that the labels and image are set properly after a call to // |configureCell:|. -TEST(PaymentRequestPaymentMethodItemTest, TextLabels) { +TEST_F(PaymentRequestPaymentMethodItemTest, TextLabels) { PaymentMethodItem* item = [[PaymentMethodItem alloc] init]; NSString* methodID = @"BobPay - ****-6789";
diff --git a/ios/chrome/browser/ui/payments/cells/payments_selector_edit_item_unittests.mm b/ios/chrome/browser/ui/payments/cells/payments_selector_edit_item_unittests.mm index de11de4..9bf5828a 100644 --- a/ios/chrome/browser/ui/payments/cells/payments_selector_edit_item_unittests.mm +++ b/ios/chrome/browser/ui/payments/cells/payments_selector_edit_item_unittests.mm
@@ -8,6 +8,7 @@ #import "ios/chrome/browser/ui/collection_view/cells/test_utils.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -15,8 +16,10 @@ namespace { +using PaymentRequestPaymentsSelectorEditItemTest = PlatformTest; + // Tests that the UILabels are set properly after a call to |configureCell:|. -TEST(PaymentRequestPaymentsSelectorEditItemTest, TextLabels) { +TEST_F(PaymentRequestPaymentsSelectorEditItemTest, TextLabels) { PaymentsSelectorEditItem* item = [[PaymentsSelectorEditItem alloc] init]; NSString* name = @"Name text"; NSString* value = @"Value text";
diff --git a/ios/chrome/browser/ui/payments/cells/payments_text_item_unittest.mm b/ios/chrome/browser/ui/payments/cells/payments_text_item_unittest.mm index 9a21700..2930b77 100644 --- a/ios/chrome/browser/ui/payments/cells/payments_text_item_unittest.mm +++ b/ios/chrome/browser/ui/payments/cells/payments_text_item_unittest.mm
@@ -7,6 +7,7 @@ #import "ios/chrome/browser/ui/collection_view/cells/test_utils.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -14,9 +15,11 @@ namespace { +using PaymentRequestPaymentsTextItemTest = PlatformTest; + // Tests that the text label and the image are set properly after a call to // |configureCell:|. -TEST(PaymentRequestPaymentsTextItemTest, TextLabelAndImage) { +TEST_F(PaymentRequestPaymentsTextItemTest, TextLabelAndImage) { PaymentsTextItem* item = [[PaymentsTextItem alloc] init]; NSString* text = @"Lorem ipsum";
diff --git a/ios/chrome/browser/ui/payments/cells/price_item_unittest.mm b/ios/chrome/browser/ui/payments/cells/price_item_unittest.mm index abb71ef7..4e442fe 100644 --- a/ios/chrome/browser/ui/payments/cells/price_item_unittest.mm +++ b/ios/chrome/browser/ui/payments/cells/price_item_unittest.mm
@@ -7,6 +7,7 @@ #import "ios/chrome/browser/ui/collection_view/cells/test_utils.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -14,8 +15,10 @@ namespace { +using PaymentRequestPriceItemTest = PlatformTest; + // Tests that the labels are set properly after a call to |configureCell:|. -TEST(PaymentRequestPriceItemTest, TextLabels) { +TEST_F(PaymentRequestPriceItemTest, TextLabels) { PriceItem* priceItem = [[PriceItem alloc] init]; NSString* item = @"Total"; @@ -41,7 +44,7 @@ } // Tests that the labels are provided with the correct amount of space. -TEST(PaymentRequestPriceItemTest, TextLabelTargetWidths) { +TEST_F(PaymentRequestPriceItemTest, TextLabelTargetWidths) { // Make the cell 164 wide so that after allocating 4 * kHorizontalPadding (16) // space for the margins and area between the labels, there is 100 available. // Accordingly, in each of the cases below where the sum of the desired label
diff --git a/ios/chrome/browser/ui/payments/country_selection_coordinator_unittest.mm b/ios/chrome/browser/ui/payments/country_selection_coordinator_unittest.mm index cf93bf8b..8e956ea 100644 --- a/ios/chrome/browser/ui/payments/country_selection_coordinator_unittest.mm +++ b/ios/chrome/browser/ui/payments/country_selection_coordinator_unittest.mm
@@ -14,7 +14,7 @@ #error "This file requires ARC support." #endif -class PaymentRequestCountrySelectionCoordinatorTest : public PlatformTest {}; +using PaymentRequestCountrySelectionCoordinatorTest = PlatformTest; // Tests that invoking start and stop on the coordinator presents and dismisses // the payment request picker view controller, respectively.
diff --git a/ios/chrome/browser/ui/payments/payment_request_error_coordinator_unittest.mm b/ios/chrome/browser/ui/payments/payment_request_error_coordinator_unittest.mm index b7fbc32..3551b08 100644 --- a/ios/chrome/browser/ui/payments/payment_request_error_coordinator_unittest.mm +++ b/ios/chrome/browser/ui/payments/payment_request_error_coordinator_unittest.mm
@@ -18,7 +18,7 @@ #error "This file requires ARC support." #endif -class PaymentRequestErrorCoordinatorTest : public PlatformTest {}; +using PaymentRequestErrorCoordinatorTest = PlatformTest; // Tests that invoking start and stop on the coordinator presents and dismisses // the payment request error view controller, respectively.
diff --git a/ios/chrome/browser/ui/reading_list/reading_list_collection_view_controller_unittest.mm b/ios/chrome/browser/ui/reading_list/reading_list_collection_view_controller_unittest.mm index a1891323..f730a90 100644 --- a/ios/chrome/browser/ui/reading_list/reading_list_collection_view_controller_unittest.mm +++ b/ios/chrome/browser/ui/reading_list/reading_list_collection_view_controller_unittest.mm
@@ -37,7 +37,7 @@ #pragma mark - ReadingListCollectionViewControllerTest -class ReadingListCollectionViewControllerTest : public testing::Test { +class ReadingListCollectionViewControllerTest : public PlatformTest { public: ReadingListCollectionViewControllerTest() {} ~ReadingListCollectionViewControllerTest() override {} @@ -51,7 +51,7 @@ id mock_delegate_; void SetUp() override { - testing::Test::SetUp(); + PlatformTest::SetUp(); EXPECT_CALL(mock_favicon_service_, GetLargestRawFaviconForPageURL(_, _, _, _, _))
diff --git a/ios/chrome/browser/ui/reading_list/text_badge_view_unittest.mm b/ios/chrome/browser/ui/reading_list/text_badge_view_unittest.mm index f1dc3db2..7f74de9 100644 --- a/ios/chrome/browser/ui/reading_list/text_badge_view_unittest.mm +++ b/ios/chrome/browser/ui/reading_list/text_badge_view_unittest.mm
@@ -6,26 +6,29 @@ #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif +using TextBadgeViewTest = PlatformTest; + // Test that the |text| property is set during initialization. -TEST(TextBadgeViewTest, CreateBadge) { +TEST_F(TextBadgeViewTest, CreateBadge) { TextBadgeView* badge = [[TextBadgeView alloc] initWithText:@"text"]; EXPECT_NSEQ(@"text", badge.text); } // Test setting the |text| property. -TEST(TextBadgeViewTest, SetText) { +TEST_F(TextBadgeViewTest, SetText) { TextBadgeView* badge = [[TextBadgeView alloc] initWithText:@"text 1"]; [badge setText:@"text 2"]; EXPECT_NSEQ(@"text 2", badge.text); } // Test that the accessibility label matches the display text. -TEST(TextBadgeViewTest, Accessibility) { +TEST_F(TextBadgeViewTest, Accessibility) { TextBadgeView* badge = [[TextBadgeView alloc] initWithText:@"display"]; UIView* superview = [[UIView alloc] initWithFrame:CGRectZero]; [superview addSubview:badge];
diff --git a/ios/chrome/browser/ui/safe_mode/safe_mode_coordinator_unittest.mm b/ios/chrome/browser/ui/safe_mode/safe_mode_coordinator_unittest.mm index f8e91c3..8521362 100644 --- a/ios/chrome/browser/ui/safe_mode/safe_mode_coordinator_unittest.mm +++ b/ios/chrome/browser/ui/safe_mode/safe_mode_coordinator_unittest.mm
@@ -8,12 +8,15 @@ #include "base/mac/scoped_nsobject.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif -TEST(SafeModeCoordinatorTest, RootVC) { +using SafeModeCoordinatorTest = PlatformTest; + +TEST_F(SafeModeCoordinatorTest, RootVC) { // Expect that starting a safe mode coordinator will populate the root view // controller. base::scoped_nsobject<UIWindow> window(
diff --git a/ios/chrome/browser/ui/settings/cells/account_signin_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/account_signin_item_unittest.mm index 9096997b..22905fd 100644 --- a/ios/chrome/browser/ui/settings/cells/account_signin_item_unittest.mm +++ b/ios/chrome/browser/ui/settings/cells/account_signin_item_unittest.mm
@@ -9,6 +9,7 @@ #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -17,7 +18,9 @@ // Tests that the UIImage and UILabels are set properly after a call to // |configureCell:|. -TEST(AccountSignInItemTest, ImageView) { +using AccountSignInItemTest = PlatformTest; + +TEST_F(AccountSignInItemTest, ImageView) { AccountSignInItem* item = [[AccountSignInItem alloc] initWithType:0]; UIImage* image = [[UIImage alloc] init];
diff --git a/ios/chrome/browser/ui/settings/cells/autofill_data_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/autofill_data_item_unittest.mm index 3dbe6cc..13e94e9d 100644 --- a/ios/chrome/browser/ui/settings/cells/autofill_data_item_unittest.mm +++ b/ios/chrome/browser/ui/settings/cells/autofill_data_item_unittest.mm
@@ -7,13 +7,16 @@ #import "ios/third_party/material_components_ios/src/components/CollectionCells/src/MaterialCollectionCells.h" #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif +using AutofillDataItemTest = PlatformTest; + // Tests that the UILabels are set properly after a call to |configureCell:|. -TEST(AutofillDataItemTest, TextLabels) { +TEST_F(AutofillDataItemTest, TextLabels) { AutofillDataItem* item = [[AutofillDataItem alloc] initWithType:0]; NSString* mainText = @"Main text"; NSString* leadingDetailText = @"Leading detail text";
diff --git a/ios/chrome/browser/ui/settings/cells/byo_textfield_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/byo_textfield_item_unittest.mm index df3ebd2b..ea858f9 100644 --- a/ios/chrome/browser/ui/settings/cells/byo_textfield_item_unittest.mm +++ b/ios/chrome/browser/ui/settings/cells/byo_textfield_item_unittest.mm
@@ -6,6 +6,7 @@ #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -13,8 +14,10 @@ namespace { +using BYOTextFieldItemTest = PlatformTest; + // Tests that the textfield is set properly after a call to |configureCell:|. -TEST(BYOTextFieldItemTest, ConfigureCell) { +TEST_F(BYOTextFieldItemTest, ConfigureCell) { BYOTextFieldItem* item = [[BYOTextFieldItem alloc] initWithType:0]; BYOTextFieldCell* cell = [[[item cellClass] alloc] init]; EXPECT_TRUE([cell isMemberOfClass:[BYOTextFieldCell class]]);
diff --git a/ios/chrome/browser/ui/settings/cells/card_multiline_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/card_multiline_item_unittest.mm index 6c08662..9cef450b 100644 --- a/ios/chrome/browser/ui/settings/cells/card_multiline_item_unittest.mm +++ b/ios/chrome/browser/ui/settings/cells/card_multiline_item_unittest.mm
@@ -6,6 +6,7 @@ #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -13,8 +14,10 @@ namespace { +using CardMultilineItemTest = PlatformTest; + // Tests that the text is honoured after a call to |configureCell:|. -TEST(CardMultilineItemTest, ConfigureCell) { +TEST_F(CardMultilineItemTest, ConfigureCell) { CardMultilineItem* item = [[CardMultilineItem alloc] initWithType:0]; NSString* text = @"Test Disclaimer"; @@ -32,7 +35,7 @@ // Tests that the text label of an CardMultilineCell spans multiple // lines. -TEST(CardMultilineItemTest, MultipleLines) { +TEST_F(CardMultilineItemTest, MultipleLines) { CardMultilineCell* cell = [[CardMultilineCell alloc] init]; EXPECT_EQ(0, cell.textLabel.numberOfLines); }
diff --git a/ios/chrome/browser/ui/settings/cells/copied_to_chrome_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/copied_to_chrome_item_unittest.mm index f8531a8..c95451c7 100644 --- a/ios/chrome/browser/ui/settings/cells/copied_to_chrome_item_unittest.mm +++ b/ios/chrome/browser/ui/settings/cells/copied_to_chrome_item_unittest.mm
@@ -9,6 +9,7 @@ #import "ios/third_party/material_components_ios/src/components/Buttons/src/MaterialButtons.h" #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" +#include "testing/platform_test.h" #include "ui/base/l10n/l10n_util_mac.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -17,8 +18,10 @@ namespace { +using CopiedToChromeItemTest = PlatformTest; + // Tests that the cell created out of a CopiedToChromeItem is set up properly. -TEST(CopiedToChromeItemTest, InitializeCell) { +TEST_F(CopiedToChromeItemTest, InitializeCell) { CopiedToChromeItem* item = [[CopiedToChromeItem alloc] initWithType:0]; id cell = [[[item cellClass] alloc] init];
diff --git a/ios/chrome/browser/ui/settings/cells/encryption_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/encryption_item_unittest.mm index 9fb0afb..11d05d1 100644 --- a/ios/chrome/browser/ui/settings/cells/encryption_item_unittest.mm +++ b/ios/chrome/browser/ui/settings/cells/encryption_item_unittest.mm
@@ -6,6 +6,7 @@ #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -13,9 +14,11 @@ namespace { +using EncryptionItemTest = PlatformTest; + // Tests that the text label, enabled status and accessory type are set properly // after a call to |configureCell:|. -TEST(EncryptionItemTest, ConfigureCell) { +TEST_F(EncryptionItemTest, ConfigureCell) { EncryptionItem* item = [[EncryptionItem alloc] initWithType:0]; EncryptionCell* cell = [[[item cellClass] alloc] init]; EXPECT_TRUE([cell isMemberOfClass:[EncryptionCell class]]);
diff --git a/ios/chrome/browser/ui/settings/cells/import_data_multiline_detail_cell_unittest.mm b/ios/chrome/browser/ui/settings/cells/import_data_multiline_detail_cell_unittest.mm index 7f633f3..a33902f2 100644 --- a/ios/chrome/browser/ui/settings/cells/import_data_multiline_detail_cell_unittest.mm +++ b/ios/chrome/browser/ui/settings/cells/import_data_multiline_detail_cell_unittest.mm
@@ -7,6 +7,7 @@ #import "ios/chrome/browser/ui/collection_view/cells/collection_view_detail_item.h" #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -14,9 +15,11 @@ namespace { +using ImportDataMultilineDetailItemTest = PlatformTest; + // Tests that the text and detail text are honoured after a call to // |configureCell:|. -TEST(ImportDataMultilineDetailItemTest, ConfigureCell) { +TEST_F(ImportDataMultilineDetailItemTest, ConfigureCell) { CollectionViewDetailItem* item = [[CollectionViewDetailItem alloc] initWithType:0]; item.cellClass = [ImportDataMultilineDetailCell class]; @@ -43,7 +46,7 @@ // Tests that the text label of an ImportDataMultilineDetailCell only has one // line but the detail text label spans multiple lines. -TEST(ImportDataMultilineDetailItemTest, MultipleLines) { +TEST_F(ImportDataMultilineDetailItemTest, MultipleLines) { ImportDataMultilineDetailCell* cell = [[ImportDataMultilineDetailCell alloc] init]; EXPECT_EQ(1, cell.textLabel.numberOfLines);
diff --git a/ios/chrome/browser/ui/settings/cells/passphrase_error_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/passphrase_error_item_unittest.mm index 932a1e0..0fda301 100644 --- a/ios/chrome/browser/ui/settings/cells/passphrase_error_item_unittest.mm +++ b/ios/chrome/browser/ui/settings/cells/passphrase_error_item_unittest.mm
@@ -6,6 +6,7 @@ #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -13,8 +14,10 @@ namespace { +using PasswordDetailsItemTest = PlatformTest; + // Tests that the text label is set properly after a call to |configureCell:|. -TEST(PasswordDetailsItemTest, ConfigureCell) { +TEST_F(PasswordDetailsItemTest, ConfigureCell) { PassphraseErrorItem* item = [[PassphraseErrorItem alloc] initWithType:0]; PassphraseErrorCell* cell = [[[item cellClass] alloc] init]; EXPECT_TRUE([cell isMemberOfClass:[PassphraseErrorCell class]]);
diff --git a/ios/chrome/browser/ui/settings/cells/password_details_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/password_details_item_unittest.mm index f3ef3a7..a5f7b21 100644 --- a/ios/chrome/browser/ui/settings/cells/password_details_item_unittest.mm +++ b/ios/chrome/browser/ui/settings/cells/password_details_item_unittest.mm
@@ -6,6 +6,7 @@ #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -13,9 +14,11 @@ namespace { +using PasswordDetailsItemTest = PlatformTest; + // Tests that the text label and showing status are set properly after a call to // |configureCell:|. -TEST(PasswordDetailsItemTest, ConfigureCell) { +TEST_F(PasswordDetailsItemTest, ConfigureCell) { PasswordDetailsItem* item = [[PasswordDetailsItem alloc] initWithType:0]; PasswordDetailsCell* cell = [[[item cellClass] alloc] init]; EXPECT_TRUE([cell isMemberOfClass:[PasswordDetailsCell class]]);
diff --git a/ios/chrome/browser/ui/settings/cells/sync_switch_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/sync_switch_item_unittest.mm index e76ff621..ec5b2b2 100644 --- a/ios/chrome/browser/ui/settings/cells/sync_switch_item_unittest.mm +++ b/ios/chrome/browser/ui/settings/cells/sync_switch_item_unittest.mm
@@ -6,6 +6,7 @@ #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -13,9 +14,11 @@ namespace { +using SyncSwitchItemTest = PlatformTest; + // Tests that the text label and showing status are set properly after a call to // |configureCell:|. -TEST(SyncSwitchItemTest, ConfigureCell) { +TEST_F(SyncSwitchItemTest, ConfigureCell) { SyncSwitchItem* item = [[SyncSwitchItem alloc] initWithType:0]; SyncSwitchCell* cell = [[[item cellClass] alloc] init]; EXPECT_TRUE([cell isMemberOfClass:[SyncSwitchCell class]]); @@ -42,7 +45,7 @@ // Tests that the text color and enabled state of the switch are set correctly // by a call to |configureCell:|. -TEST(SyncSwitchItemTest, EnabledAndDisabled) { +TEST_F(SyncSwitchItemTest, EnabledAndDisabled) { SyncSwitchCell* cell = [[SyncSwitchCell alloc] init]; SyncSwitchItem* item = [[SyncSwitchItem alloc] initWithType:0]; item.text = @"Test Switch"; @@ -82,7 +85,7 @@ EXPECT_NSEQ(disabledColor, cell.textLabel.textColor); } -TEST(SyncSwitchItemTest, PrepareForReuseClearsActions) { +TEST_F(SyncSwitchItemTest, PrepareForReuseClearsActions) { SyncSwitchCell* cell = [[SyncSwitchCell alloc] init]; UISwitch* switchView = cell.switchView; NSArray* target = [NSArray array];
diff --git a/ios/chrome/browser/ui/settings/cells/text_and_error_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/text_and_error_item_unittest.mm index 1106c7b..e4cdf8c 100644 --- a/ios/chrome/browser/ui/settings/cells/text_and_error_item_unittest.mm +++ b/ios/chrome/browser/ui/settings/cells/text_and_error_item_unittest.mm
@@ -7,6 +7,7 @@ #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -14,9 +15,11 @@ namespace { +using TextAndErrorItemTest = PlatformTest; + // Tests that the error UIImage and UILabels are set properly after a call to // |configureCell:|. -TEST(TextAndErrorItemTest, ImageViewAndLabels) { +TEST_F(TextAndErrorItemTest, ImageViewAndLabels) { TextAndErrorItem* item = [[TextAndErrorItem alloc] initWithType:0]; item.text = @"Test"; item.shouldDisplayError = YES;
diff --git a/ios/chrome/browser/ui/settings/cells/version_item_unittest.mm b/ios/chrome/browser/ui/settings/cells/version_item_unittest.mm index b1b654f..eac2c61 100644 --- a/ios/chrome/browser/ui/settings/cells/version_item_unittest.mm +++ b/ios/chrome/browser/ui/settings/cells/version_item_unittest.mm
@@ -7,6 +7,7 @@ #import "ios/chrome/browser/ui/collection_view/cells/collection_view_item.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -14,7 +15,9 @@ namespace { -TEST(VersionItemTest, TextLabelGetsText) { +using VersionItemTest = PlatformTest; + +TEST_F(VersionItemTest, TextLabelGetsText) { VersionItem* item = [[VersionItem alloc] initWithType:0]; VersionCell* cell = [[[item cellClass] alloc] init]; EXPECT_TRUE([cell isMemberOfClass:[VersionCell class]]);
diff --git a/ios/chrome/browser/ui/snackbar/snackbar_coordinator_unittest.mm b/ios/chrome/browser/ui/snackbar/snackbar_coordinator_unittest.mm index efb2905..e4fcd353 100644 --- a/ios/chrome/browser/ui/snackbar/snackbar_coordinator_unittest.mm +++ b/ios/chrome/browser/ui/snackbar/snackbar_coordinator_unittest.mm
@@ -7,6 +7,7 @@ #import "ios/chrome/browser/ui/commands/command_dispatcher.h" #import "ios/chrome/browser/ui/commands/snackbar_commands.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #import "third_party/ocmock/OCMock/OCMock.h" #include "third_party/ocmock/gtest_support.h" @@ -14,8 +15,10 @@ #error "This file requires ARC support." #endif +using SnackbarCoordinatorTest = PlatformTest; + // Tests that the coordinator handles snackbar commands. -TEST(SnackbarCoordinatorTest, RegistersDispatching) { +TEST_F(SnackbarCoordinatorTest, RegistersDispatching) { id dispatcher = OCMClassMock([CommandDispatcher class]); SnackbarCoordinator* coordinator = [[SnackbarCoordinator alloc] init]; coordinator.dispatcher = dispatcher;
diff --git a/ios/chrome/browser/ui/stack_view/card_stack_layout_manager_unittest.mm b/ios/chrome/browser/ui/stack_view/card_stack_layout_manager_unittest.mm index 1d3a6c7..a942b6f 100644 --- a/ios/chrome/browser/ui/stack_view/card_stack_layout_manager_unittest.mm +++ b/ios/chrome/browser/ui/stack_view/card_stack_layout_manager_unittest.mm
@@ -45,8 +45,7 @@ namespace { -// Create a fixture to get an autorelease pool. -class CardStackLayoutManagerTest : public PlatformTest {}; +using CardStackLayoutManagerTest = PlatformTest; const float kMargin = 5; const float kMaxStagger = 40;
diff --git a/ios/chrome/browser/ui/ui_util_unittest.mm b/ios/chrome/browser/ui/ui_util_unittest.mm index 1a2c2d39..38c38c6 100644 --- a/ios/chrome/browser/ui/ui_util_unittest.mm +++ b/ios/chrome/browser/ui/ui_util_unittest.mm
@@ -10,12 +10,15 @@ #include "base/macros.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif -TEST(UIUtilTest, AlignToPixel) { +using UIUtilTest = PlatformTest; + +TEST_F(UIUtilTest, AlignToPixel) { CGFloat scale = [[UIScreen mainScreen] scale]; // Pick a few interesting values: already aligned, aligned on retina, and // some unaligned values that would round differently. Ensure that all are @@ -43,7 +46,7 @@ #define EXPECT_EQ_SIZE(a, b) \ EXPECT_NSEQ(NSStringFromCGSize(a), NSStringFromCGSize(b)) -TEST(UIUtilTest, TestProjectionFill) { +TEST_F(UIUtilTest, TestProjectionFill) { CGSize originalSize, targetSize, expectedRevisedSize, revisedSize; CGRect expectedProjection, projection; @@ -78,7 +81,7 @@ EXPECT_EQ_SIZE(expectedRevisedSize, revisedSize); } -TEST(UIUtilTest, TestProjectionFit) { +TEST_F(UIUtilTest, TestProjectionFit) { CGSize originalSize, targetSize, expectedRevisedSize, revisedSize; CGRect expectedProjection, projection; @@ -143,7 +146,7 @@ EXPECT_EQ_SIZE(expectedRevisedSize, revisedSize); } -TEST(UIUtilTest, TestProjectionAspectFill) { +TEST_F(UIUtilTest, TestProjectionAspectFill) { CGSize originalSize, targetSize, expectedRevisedSize, revisedSize; CGRect expectedProjection, projection; @@ -208,7 +211,7 @@ EXPECT_EQ_SIZE(expectedRevisedSize, revisedSize); } -TEST(UIUtilTest, TestProjectionAspectFillAlignTop) { +TEST_F(UIUtilTest, TestProjectionAspectFillAlignTop) { CGSize originalSize, targetSize, expectedRevisedSize, revisedSize; CGRect expectedProjection, projection; @@ -235,7 +238,7 @@ EXPECT_EQ_SIZE(expectedRevisedSize, revisedSize); } -TEST(UIUtilTest, TestProjectionAspectFillNoClipping) { +TEST_F(UIUtilTest, TestProjectionAspectFillNoClipping) { CGSize originalSize, targetSize, expectedRevisedSize, revisedSize; CGRect expectedProjection, projection;
diff --git a/ios/chrome/browser/ui/uikit_ui_util_unittest.mm b/ios/chrome/browser/ui/uikit_ui_util_unittest.mm index 2016210..084d82fa 100644 --- a/ios/chrome/browser/ui/uikit_ui_util_unittest.mm +++ b/ios/chrome/browser/ui/uikit_ui_util_unittest.mm
@@ -7,6 +7,7 @@ #include "base/strings/sys_string_conversions.h" #import "ios/chrome/browser/ui/ui_util.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #import "third_party/ocmock/OCMock/OCMock.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -29,10 +30,12 @@ EXPECT_FLOAT_EQ(1.0, a); } +using UIKitUIUtilTest = PlatformTest; + // Verify the assumption about UIViewController that on iPad all orientations // are supported, and all orientations but Portrait Upside-Down on iPhone and // iPod Touch. -TEST(UIKitUIUtilTest, UIViewControllerSupportedOrientationsTest) { +TEST_F(UIKitUIUtilTest, UIViewControllerSupportedOrientationsTest) { UIViewController* viewController = [[UIViewController alloc] initWithNibName:nil bundle:nil]; if (IsIPadIdiom()) { @@ -44,13 +47,13 @@ } } -TEST(UIKitUIUtilTest, TestGetUiFont) { +TEST_F(UIKitUIUtilTest, TestGetUiFont) { EXPECT_TRUE(GetUIFont(FONT_HELVETICA, false, 15.0)); EXPECT_TRUE(GetUIFont(FONT_HELVETICA_NEUE, true, 15.0)); } // Verifies that greyImage never returns retina-scale images. -TEST(UIKitUIUtilTest, TestGreyImage) { +TEST_F(UIKitUIUtilTest, TestGreyImage) { // Create an image using the device's scale factor. const CGSize kSize = CGSizeMake(100, 100); UIGraphicsBeginImageContextWithOptions(kSize, NO, 0.0); @@ -78,7 +81,7 @@ return image; } -TEST(UIKitUIUtilTest, TestResizeImageOpacity) { +TEST_F(UIKitUIUtilTest, TestResizeImageOpacity) { UIImage* actual; UIImage* image = testImage(CGSizeMake(100, 100)); actual = @@ -92,7 +95,7 @@ EXPECT_TRUE(ImageHasAlphaChannel(actual)); } -TEST(UIKitUIUtilTest, TestResizeImageInvalidInput) { +TEST_F(UIKitUIUtilTest, TestResizeImageInvalidInput) { UIImage* actual; UIImage* image = testImage(CGSizeMake(100, 50)); actual = ResizeImage(image, CGSizeZero, ProjectionMode::kAspectFit); @@ -109,7 +112,7 @@ EXPECT_FALSE(actual); } -TEST(UIKitUIUtilTest, TintImageKeepsImageProperties) { +TEST_F(UIKitUIUtilTest, TintImageKeepsImageProperties) { UIImage* image = testImage(CGSizeMake(100, 75)); UIImage* tintedImage = TintImage(image, [UIColor blueColor]); EXPECT_EQ(image.size.width, tintedImage.size.width); @@ -123,7 +126,7 @@ tintedImage.flipsForRightToLeftLayoutDirection); } -TEST(UIKitUIUtilTest, TestInterpolateFromColorToColor) { +TEST_F(UIKitUIUtilTest, TestInterpolateFromColorToColor) { CGFloat colorOne = 50.0f / 255.0f; CGFloat colorTwo = 100.0f / 255.0f; CGFloat expectedOne = 50.0f / 255.0f; @@ -142,7 +145,7 @@ } // Tests that InterpolateFromColorToColor() works for monochrome colors. -TEST(UIKitUIUtilTest, TestInterpolateFromColorToColorMonochrome) { +TEST_F(UIKitUIUtilTest, TestInterpolateFromColorToColorMonochrome) { CGFloat kRGBComponent = 0.2; UIColor* rgb = [UIColor colorWithRed:kRGBComponent green:kRGBComponent
diff --git a/ios/chrome/browser/ui/util/constraints_ui_util_unittest.mm b/ios/chrome/browser/ui/util/constraints_ui_util_unittest.mm index e79697c5..0a8644cf 100644 --- a/ios/chrome/browser/ui/util/constraints_ui_util_unittest.mm +++ b/ios/chrome/browser/ui/util/constraints_ui_util_unittest.mm
@@ -14,9 +14,11 @@ namespace { +using ConstraintsUIUtilTest = PlatformTest; + // Tests that SafeAreaLayoutGuideForView returns and attach a single // safeAreaLayoutGuide before iOS 11. -TEST(ConstraintsUIUtilTest, SafeAreaLayoutGuideForView) { +TEST_F(ConstraintsUIUtilTest, SafeAreaLayoutGuideForView) { if (@available(iOS 11, *)) { } else { UIView* view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
diff --git a/ios/chrome/browser/ui/util/core_text_util_unittest.mm b/ios/chrome/browser/ui/util/core_text_util_unittest.mm index e56a354..911f315 100644 --- a/ios/chrome/browser/ui/util/core_text_util_unittest.mm +++ b/ios/chrome/browser/ui/util/core_text_util_unittest.mm
@@ -16,8 +16,10 @@ // TODO(crbug.com/601772): Add tests for other core_text_util tests. +using CoreTextUtilTest = PlatformTest; + // Tests that the minimum line height attribute is reflected in GetLineHeight(). -TEST(CoreTextUtilTest, MinLineHeightText) { +TEST_F(CoreTextUtilTest, MinLineHeightText) { CGFloat min_line_height = 30.0; NSMutableParagraphStyle* style = [[NSMutableParagraphStyle alloc] init]; [style setMinimumLineHeight:min_line_height]; @@ -29,7 +31,7 @@ } // Tests that the maximum line height attribute is reflected in GetLineHeight(). -TEST(CoreTextUtilTest, MaxLineHeightText) { +TEST_F(CoreTextUtilTest, MaxLineHeightText) { CGFloat max_line_height = 10.0; NSMutableParagraphStyle* style = [[NSMutableParagraphStyle alloc] init]; [style setMaximumLineHeight:max_line_height]; @@ -42,7 +44,7 @@ // Tests that the line height multiple attribute is reflected in // GetLineHeight(). -TEST(CoreTextUtilTest, LineHeightMultipleTest) { +TEST_F(CoreTextUtilTest, LineHeightMultipleTest) { UIFont* font = [UIFont systemFontOfSize:20.0]; CGFloat font_line_height = font.ascender - font.descender; CGFloat line_height_multiple = 2.0;
diff --git a/ios/chrome/browser/ui/util/named_guide_unittest.mm b/ios/chrome/browser/ui/util/named_guide_unittest.mm index 01b5aacd..26476d67 100644 --- a/ios/chrome/browser/ui/util/named_guide_unittest.mm +++ b/ios/chrome/browser/ui/util/named_guide_unittest.mm
@@ -6,13 +6,16 @@ #include "base/logging.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif +using NamedGuideTest = PlatformTest; + // Tests that guides are reachable after being added to a view. -TEST(NamedGuideTest, TestAddAndFind) { +TEST_F(NamedGuideTest, TestAddAndFind) { GuideName* test_guide = @"NamedGuideTest"; UIView* view = [[UIView alloc] init]; @@ -24,7 +27,7 @@ } // Tests that guides added to a child view are not reachable from the parent. -TEST(NamedGuideTest, TestGuideOnChild) { +TEST_F(NamedGuideTest, TestGuideOnChild) { GuideName* test_guide = @"NamedGuideTest"; UIView* view = [[UIView alloc] init]; @@ -38,7 +41,7 @@ } // Tests that children can reach guides that are added to ancestors. -TEST(NamedGuideTest, TestGuideOnAncestor) { +TEST_F(NamedGuideTest, TestGuideOnAncestor) { GuideName* test_guide = @"NamedGuideTest"; UIView* view = [[UIView alloc] init];
diff --git a/ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate_unittest.cc b/ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate_unittest.cc index b6b0a4d..c8edc94 100644 --- a/ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate_unittest.cc +++ b/ios/chrome/browser/update_client/ios_chrome_update_query_params_delegate_unittest.cc
@@ -13,6 +13,7 @@ #include "components/version_info/version_info.h" #include "ios/chrome/common/channel_info.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" using base::StringPrintf; @@ -48,7 +49,9 @@ IOSChromeUpdateQueryParamsDelegate::GetLang().c_str()))); } -TEST(IOSChromeUpdateQueryParamsDelegateTest, GetParams) { +using IOSChromeUpdateQueryParamsDelegateTest = PlatformTest; + +TEST_F(IOSChromeUpdateQueryParamsDelegateTest, GetParams) { base::ScopedClosureRunner runner( base::Bind(update_client::UpdateQueryParams::SetDelegate, nullptr)); update_client::UpdateQueryParams::SetDelegate(
diff --git a/ios/chrome/browser/voice/text_to_speech_parser_unittest.mm b/ios/chrome/browser/voice/text_to_speech_parser_unittest.mm index 8ac971b1..5616cb73 100644 --- a/ios/chrome/browser/voice/text_to_speech_parser_unittest.mm +++ b/ios/chrome/browser/voice/text_to_speech_parser_unittest.mm
@@ -6,6 +6,7 @@ #import "ios/chrome/browser/voice/text_to_speech_parser.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #import "third_party/google_toolbox_for_mac/src/Foundation/GTMStringEncoding.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -21,7 +22,9 @@ NSString* const kInvalidVoiceSearchHTML = @"no TTS data"; } // namespace -TEST(TextToSpeechParser, ExtractAudioDataValid) { +using TextToSpeechParser = PlatformTest; + +TEST_F(TextToSpeechParser, ExtractAudioDataValid) { NSData* result = ExtractVoiceSearchAudioDataFromPageHTML(kValidVoiceSearchHTML); @@ -32,7 +35,7 @@ EXPECT_TRUE([expectedData isEqualToData:result]); } -TEST(TextToSpeechParser, ExtractAudioDataNotFound) { +TEST_F(TextToSpeechParser, ExtractAudioDataNotFound) { NSData* result = ExtractVoiceSearchAudioDataFromPageHTML(kInvalidVoiceSearchHTML); EXPECT_TRUE(result == nil);
diff --git a/ios/chrome/browser/web/external_app_launcher_unittest.mm b/ios/chrome/browser/web/external_app_launcher_unittest.mm index 5251de9..09ff757 100644 --- a/ios/chrome/browser/web/external_app_launcher_unittest.mm +++ b/ios/chrome/browser/web/external_app_launcher_unittest.mm
@@ -6,6 +6,7 @@ #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -19,7 +20,9 @@ namespace { -TEST(ExternalAppLauncherTest, TestBadFormatCallArgument) { +using ExternalAppLauncherTest = PlatformTest; + +TEST_F(ExternalAppLauncherTest, TestBadFormatCallArgument) { EXPECT_NSEQ(@"garbage:", [ExternalAppLauncher formatCallArgument:[NSURL URLWithString:@"garbage:"]]); @@ -28,7 +31,7 @@ formatCallArgument:[NSURL URLWithString:@"malformed:////"]]); } -TEST(ExternalAppLauncherTest, TestFormatCallArgument) { +TEST_F(ExternalAppLauncherTest, TestFormatCallArgument) { EXPECT_NSEQ( @"+1234", [ExternalAppLauncher @@ -46,7 +49,7 @@ formatCallArgument:[NSURL URLWithString:@"garbage:75009"]]); } -TEST(ExternalAppLauncherTest, TestURLEscapedArgument) { +TEST_F(ExternalAppLauncherTest, TestURLEscapedArgument) { EXPECT_NSEQ(@"+1 650 555 1212", [ExternalAppLauncher formatCallArgument:
diff --git a/ios/chrome/browser/web/mailto_handler_gmail_unittest.mm b/ios/chrome/browser/web/mailto_handler_gmail_unittest.mm index d5c5266..93ba9a7c 100644 --- a/ios/chrome/browser/web/mailto_handler_gmail_unittest.mm +++ b/ios/chrome/browser/web/mailto_handler_gmail_unittest.mm
@@ -6,12 +6,15 @@ #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif -TEST(MailtoHandlerGmailTest, TestConstructor) { +using MailtoHandlerGmailTest = PlatformTest; + +TEST_F(MailtoHandlerGmailTest, TestConstructor) { MailtoHandlerGmail* handler = [[MailtoHandlerGmail alloc] init]; EXPECT_NSEQ(@"Gmail", [handler appName]); EXPECT_NSEQ(@"422689480", [handler appStoreID]);
diff --git a/ios/chrome/browser/web/mailto_handler_inbox_unittest.mm b/ios/chrome/browser/web/mailto_handler_inbox_unittest.mm index 856097c8..98b15217 100644 --- a/ios/chrome/browser/web/mailto_handler_inbox_unittest.mm +++ b/ios/chrome/browser/web/mailto_handler_inbox_unittest.mm
@@ -6,12 +6,15 @@ #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif -TEST(MailtoHandlerInboxTest, TestConstructor) { +using MailtoHandlerInboxTest = PlatformTest; + +TEST_F(MailtoHandlerInboxTest, TestConstructor) { MailtoHandlerInbox* handler = [[MailtoHandlerInbox alloc] init]; EXPECT_NSEQ(@"Inbox by Gmail", [handler appName]); EXPECT_NSEQ(@"905060486", [handler appStoreID]);
diff --git a/ios/chrome/browser/web/mailto_handler_system_mail_unittest.mm b/ios/chrome/browser/web/mailto_handler_system_mail_unittest.mm index 86bb5c9f..1ee8beab 100644 --- a/ios/chrome/browser/web/mailto_handler_system_mail_unittest.mm +++ b/ios/chrome/browser/web/mailto_handler_system_mail_unittest.mm
@@ -6,13 +6,16 @@ #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #include "url/gurl.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif -TEST(MailtoHandlerSystemMailTest, TestConstructor) { +using MailtoHandlerSystemMailTest = PlatformTest; + +TEST_F(MailtoHandlerSystemMailTest, TestConstructor) { MailtoHandler* handler = [[MailtoHandlerSystemMail alloc] init]; EXPECT_TRUE(handler); EXPECT_NSEQ(@"Mail", [handler appName]); @@ -20,7 +23,7 @@ EXPECT_TRUE([handler isAvailable]); } -TEST(MailtoHandlerSystemMailTest, TestRewrite) { +TEST_F(MailtoHandlerSystemMailTest, TestRewrite) { MailtoHandler* handler = [[MailtoHandlerSystemMail alloc] init]; NSString* result = [handler rewriteMailtoURL:GURL("mailto:user@domain.com")]; EXPECT_NSEQ(@"mailto:user@domain.com", result);
diff --git a/ios/chrome/browser/web/mailto_handler_unittest.mm b/ios/chrome/browser/web/mailto_handler_unittest.mm index 18e4375..4a10a9ac 100644 --- a/ios/chrome/browser/web/mailto_handler_unittest.mm +++ b/ios/chrome/browser/web/mailto_handler_unittest.mm
@@ -6,14 +6,17 @@ #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #include "url/gurl.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif +using MailtoHandlerTest = PlatformTest; + // Tests constructor. -TEST(MailtoHandlerTest, TestConstructor) { +TEST_F(MailtoHandlerTest, TestConstructor) { MailtoHandler* handler = [[MailtoHandler alloc] initWithName:@"Some App" appStoreID:@"12345"]; EXPECT_NSEQ(@"Some App", [handler appName]); @@ -22,7 +25,7 @@ } // Tests mailto URL with and without a subject. -TEST(MailtoHandlerTest, TestRewriteGood) { +TEST_F(MailtoHandlerTest, TestRewriteGood) { MailtoHandler* handler = [[MailtoHandler alloc] initWithName:@"Some App" appStoreID:@"12345"]; NSString* result = [handler rewriteMailtoURL:GURL("mailto:user@domain.com")]; @@ -34,7 +37,7 @@ } // Tests mailto URL with unrecognized query parameters. -TEST(MailtoHandlerTest, TestRewriteUnrecognizedParams) { +TEST_F(MailtoHandlerTest, TestRewriteUnrecognizedParams) { MailtoHandler* handler = [[MailtoHandler alloc] initWithName:@"Some App" appStoreID:@"12345"]; NSString* result = [handler @@ -44,7 +47,7 @@ } // Tests mailto URL with a body that includes a = sign. -TEST(MailtoHandlerTest, TestRewriteBodyWithUrl) { +TEST_F(MailtoHandlerTest, TestRewriteBodyWithUrl) { MailtoHandler* handler = [[MailtoHandler alloc] initWithName:@"Some App" appStoreID:@"12345"]; NSString* result = [handler @@ -54,7 +57,7 @@ } // Tests mailto URL with parameters that are mixed upper/lower cases. -TEST(MailtoHandlerTest, TestRewriteWithMixedCase) { +TEST_F(MailtoHandlerTest, TestRewriteWithMixedCase) { MailtoHandler* handler = [[MailtoHandler alloc] initWithName:@"Some App" appStoreID:@"12345"]; NSString* result = @@ -63,7 +66,7 @@ } // Tests that non-mailto URLs returns nil. -TEST(MailtoHandlerTest, TestRewriteNotMailto) { +TEST_F(MailtoHandlerTest, TestRewriteNotMailto) { MailtoHandler* handler = [[MailtoHandler alloc] initWithName:@"Some App" appStoreID:@"12345"]; NSString* result = [handler rewriteMailtoURL:GURL("http://www.google.com")];
diff --git a/ios/chrome/browser/web/network_activity_indicator_tab_helper_unittest.mm b/ios/chrome/browser/web/network_activity_indicator_tab_helper_unittest.mm index 1898532..cf02031 100644 --- a/ios/chrome/browser/web/network_activity_indicator_tab_helper_unittest.mm +++ b/ios/chrome/browser/web/network_activity_indicator_tab_helper_unittest.mm
@@ -9,6 +9,7 @@ #import "ios/web/public/test/fakes/test_web_state.h" #import "ios/web/public/test/web_test.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -16,9 +17,11 @@ using web::TestWebState; +using NetworkActivityIndicatorTabHelperTest = PlatformTest; + // Tests that the network activity for a single WebState correctly manages // the state of the network activity indicator. -TEST(NetworkActivityIndicatorTabHelperTest, SingleWebStateActivity) { +TEST_F(NetworkActivityIndicatorTabHelperTest, SingleWebStateActivity) { std::unique_ptr<TestWebState> web_state(new TestWebState()); NetworkActivityIndicatorTabHelper::CreateForWebState(web_state.get(), @"web_state1"); @@ -37,7 +40,7 @@ // Tests that the network activity for multiple WebStates correctly manage // the state of the network activity indicator. -TEST(NetworkActivityIndicatorTabHelperTest, MultipleWebStateActivity) { +TEST_F(NetworkActivityIndicatorTabHelperTest, MultipleWebStateActivity) { std::unique_ptr<TestWebState> web_state1(new TestWebState()); NetworkActivityIndicatorTabHelper::CreateForWebState(web_state1.get(), @"web_state1"); @@ -65,7 +68,7 @@ // Tests that the network activity for a single WebState correctly stops when // the WebState is deallocated. -TEST(NetworkActivityIndicatorTabHelperTest, WebStateDeallocated) { +TEST_F(NetworkActivityIndicatorTabHelperTest, WebStateDeallocated) { std::unique_ptr<TestWebState> web_state(new TestWebState()); NetworkActivityIndicatorTabHelper::CreateForWebState(web_state.get(), @"web_state1");
diff --git a/ios/chrome/browser/web_resource/web_resource_util_unittest.cc b/ios/chrome/browser/web_resource/web_resource_util_unittest.cc index ac1950a..decd97a 100644 --- a/ios/chrome/browser/web_resource/web_resource_util_unittest.cc +++ b/ios/chrome/browser/web_resource/web_resource_util_unittest.cc
@@ -15,10 +15,11 @@ #include "base/values.h" #include "ios/web/public/web_thread.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" namespace web_resource { -class WebResourceUtilTest : public testing::Test { +class WebResourceUtilTest : public PlatformTest { protected: WebResourceUtilTest() : error_called_(false), success_called_(false) {} ~WebResourceUtilTest() override {}
diff --git a/ios/chrome/common/ns_regular_expression_unittest.mm b/ios/chrome/common/ns_regular_expression_unittest.mm index d19f476b..022ac63 100644 --- a/ios/chrome/common/ns_regular_expression_unittest.mm +++ b/ios/chrome/common/ns_regular_expression_unittest.mm
@@ -64,13 +64,15 @@ error:&error]; } -TEST(NSRegularExpressionTest, TestSimpleRegex) { +using NSRegularExpressionTest = PlatformTest; + +TEST_F(NSRegularExpressionTest, TestSimpleRegex) { NSRegularExpression* regex = MakeRegularExpression(@"foo(.*)bar(.*)"); ExpectRegexMatched(regex, @"fooONEbarTWO", @"first $1, second $2", @"first ONE, second TWO"); } -TEST(NSRegularExpressionTest, TestComplexRegex) { +TEST_F(NSRegularExpressionTest, TestComplexRegex) { NSString* expression = @"^http[s]?://" "(?:" "(?:youtu\\.be/)|" @@ -89,7 +91,7 @@ ExpectRegexNotMatched(regex, @"http://www.youtube.com/embed/GkOZ8DfO248"); } -TEST(NSRegularExpressionTest, TestSimpleAlternation) { +TEST_F(NSRegularExpressionTest, TestSimpleAlternation) { // This test verifies how NSRegularExpression works. // Regex 'ab|c' matches 'ab', 'ac', or 'c'. Does not match 'abc', 'a', or 'b'. NSRegularExpression* regex = MakeRegularExpression(@"^ab|c$"); @@ -115,7 +117,7 @@ ExpectRegexNotMatched(regex, @"abc"); } -TEST(NSRegularExpressionTest, TestUberCaptureGroup) { +TEST_F(NSRegularExpressionTest, TestUberCaptureGroup) { // The absence of an uber-capture group caused NSRegularExpression to crash on // iOS 5.x. This tests to make sure that it is not happening on iOS 6+ // environments.
diff --git a/ios/chrome/common/string_util_unittest.mm b/ios/chrome/common/string_util_unittest.mm index 07dc110..98f4772 100644 --- a/ios/chrome/common/string_util_unittest.mm +++ b/ios/chrome/common/string_util_unittest.mm
@@ -16,7 +16,9 @@ namespace { -TEST(StringUtilTest, ParseStringWithLink) { +using StringUtilTest = PlatformTest; + +TEST_F(StringUtilTest, ParseStringWithLink) { NSArray* const all_test_data = @[ @{ @"input" : @"Text without link.", @@ -60,7 +62,7 @@ } } -TEST(StringUtilTest, CleanNSStringForDisplay) { +TEST_F(StringUtilTest, CleanNSStringForDisplay) { NSArray* const all_test_data = @[ @{ @"input" : @"Clean String", @@ -99,7 +101,9 @@ } } -TEST(StringUnitTest, SubstringOfWidth) { +using StringUnitTest = PlatformTest; + +TEST_F(StringUnitTest, SubstringOfWidth) { // returns nil for zero-length strings EXPECT_NSEQ(SubstringOfWidth(@"", @{}, 100, NO), nil); EXPECT_NSEQ(SubstringOfWidth(nil, @{}, 100, NO), nil);
diff --git a/ios/chrome/common/x_callback_url_unittest.cc b/ios/chrome/common/x_callback_url_unittest.cc index f445288..559208f 100644 --- a/ios/chrome/common/x_callback_url_unittest.cc +++ b/ios/chrome/common/x_callback_url_unittest.cc
@@ -6,6 +6,7 @@ #include "base/strings/stringprintf.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" namespace { @@ -20,7 +21,9 @@ const char* expected; }; -TEST(XCallbackURLTest, IsXCallbackURL) { +using XCallbackURLTest = PlatformTest; + +TEST_F(XCallbackURLTest, IsXCallbackURL) { EXPECT_TRUE(IsXCallbackURL(GURL("chrome://x-callback-url"))); EXPECT_TRUE(IsXCallbackURL(GURL("https://x-callback-url"))); EXPECT_TRUE(IsXCallbackURL(GURL("exotic-scheme://x-callback-url"))); @@ -34,7 +37,7 @@ EXPECT_FALSE(IsXCallbackURL(GURL("https://www.google.com"))); } -TEST(XCallbackURLTest, URLWithScheme) { +TEST_F(XCallbackURLTest, URLWithScheme) { const XCallbackURLEncodeTestCase test_cases[] = { { "chrome", @@ -121,7 +124,7 @@ std::map<std::string, std::string> expected; }; -TEST(XCallbackURLTest, QueryParameters) { +TEST_F(XCallbackURLTest, QueryParameters) { const XCallbackURLDecodeTestCase test_cases[] = { { GURL("chrome://x-callback-url/"),
diff --git a/ios/chrome/test/base/scoped_block_swizzler_unittest.mm b/ios/chrome/test/base/scoped_block_swizzler_unittest.mm index 111cf104..2af049c 100644 --- a/ios/chrome/test/base/scoped_block_swizzler_unittest.mm +++ b/ios/chrome/test/base/scoped_block_swizzler_unittest.mm
@@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/mac/foundation_util.h" #include "ios/chrome/test/base/scoped_block_swizzler.h" +#include "base/mac/foundation_util.h" #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" #include "testing/platform_test.h" @@ -29,8 +29,10 @@ NSString* const kOriginalInstanceValue = @"Bizz"; NSString* const kSwizzledInstanceValue = @"Buzz"; +using ScopedBlockSwizzlerTest = PlatformTest; + // Tests that swizzling a class method works properly. -TEST(ScopedBlockSwizzlerTest, SwizzlingClassMethods) { +TEST_F(ScopedBlockSwizzlerTest, SwizzlingClassMethods) { EXPECT_NSEQ(kOriginalClassValue, [ScopedBlockSwizzlerTestClass classMethodToSwizzle]); @@ -47,7 +49,7 @@ } // Tests that swizzling an instance method works properly. -TEST(ScopedBlockSwizzlerTest, SwizzlingInstanceMethod) { +TEST_F(ScopedBlockSwizzlerTest, SwizzlingInstanceMethod) { ScopedBlockSwizzlerTestClass* target = [[ScopedBlockSwizzlerTestClass alloc] init]; target.value = kSwizzledInstanceValue; @@ -71,7 +73,7 @@ // Tests that calling |ScopedBlockSwizzler::reset()| properly unswizzles the // method. -TEST(ScopedBlockSwizzlerTest, TestReset) { +TEST_F(ScopedBlockSwizzlerTest, TestReset) { EXPECT_NSEQ(kOriginalClassValue, [ScopedBlockSwizzlerTestClass classMethodToSwizzle]);
diff --git a/ios/chrome/test/google_toolbox_unittest.mm b/ios/chrome/test/google_toolbox_unittest.mm index 196afd4b..a264036 100644 --- a/ios/chrome/test/google_toolbox_unittest.mm +++ b/ios/chrome/test/google_toolbox_unittest.mm
@@ -6,15 +6,18 @@ #include "base/logging.h" #import "testing/gtest_mac.h" +#include "testing/platform_test.h" #import "third_party/google_toolbox_for_mac/src/Foundation/GTMNSDictionary+URLArguments.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif +using GoogleToolboxForMacTest = PlatformTest; + // [NSDictionary gtm_dictionaryWithHttpArgumentsString] is used downstream. // This test ensures that we keep compiling the file. -TEST(GoogleToolboxForMacTest, dictionaryWithHttpArgumentsString) { +TEST_F(GoogleToolboxForMacTest, dictionaryWithHttpArgumentsString) { NSDictionary* dict = [NSDictionary gtm_dictionaryWithHttpArgumentsString:@""]; EXPECT_EQ(0u, [dict count]); }
diff --git a/ios/clean/chrome/app/steps/phased_step_runner_unittest.mm b/ios/clean/chrome/app/steps/phased_step_runner_unittest.mm index 2599418..f7489ca 100644 --- a/ios/clean/chrome/app/steps/phased_step_runner_unittest.mm +++ b/ios/clean/chrome/app/steps/phased_step_runner_unittest.mm
@@ -94,7 +94,9 @@ @end -TEST(PhasedStepRunnerTest, TestUnexecutedSteps) { +using PhasedStepRunnerTest = PlatformTest; + +TEST_F(PhasedStepRunnerTest, TestUnexecutedSteps) { TestStep* step1 = [[TestStep alloc] init]; step1.providedFeature = @"feature_a"; @@ -125,7 +127,7 @@ } // Simple dependency chain A-> B-> C -TEST(PhasedStepRunnerTest, TestSimpleDependencies) { +TEST_F(PhasedStepRunnerTest, TestSimpleDependencies) { TestStep* step1 = [[TestStep alloc] init]; step1.providedFeature = @"feature_a"; @@ -157,7 +159,7 @@ } // Dependency graph: A->B; B->C; B->D, C->D. -TEST(PhasedStepRunnerTest, TestDependencyGraph) { +TEST_F(PhasedStepRunnerTest, TestDependencyGraph) { TestStep* step1 = [[TestStep alloc] init]; step1.providedFeature = @"feature_a"; @@ -194,7 +196,7 @@ EXPECT_TRUE(task4.hasRun); } -TEST(PhasedStepRunnerTest, TestOneAsyncAction) { +TEST_F(PhasedStepRunnerTest, TestOneAsyncAction) { AsyncTestStep* step1 = [[AsyncTestStep alloc] init]; step1.providedFeature = @"feature_a"; NSUInteger testPhase = 1; @@ -209,7 +211,7 @@ EXPECT_TRUE(step1.hasRun); } -TEST(PhasedStepRunnerTest, TestAsyncDependencies) { +TEST_F(PhasedStepRunnerTest, TestAsyncDependencies) { AsyncTestStep* step1 = [[AsyncTestStep alloc] init]; step1.providedFeature = @"feature_a"; @@ -240,7 +242,7 @@ EXPECT_TRUE(task3.hasRun); } -TEST(PhasedStepRunnerTest, TestManyDependencies) { +TEST_F(PhasedStepRunnerTest, TestManyDependencies) { NSMutableArray<TestStep*>* tasks = [[NSMutableArray alloc] init]; AsyncTestStep* root_task = [[AsyncTestStep alloc] init]; root_task.providedFeature = @"feature_a"; @@ -305,7 +307,7 @@ } // Simple phase change -TEST(PhasedStepRunnerTest, TestPhaseChangeInStep) { +TEST_F(PhasedStepRunnerTest, TestPhaseChangeInStep) { TestStep* step1 = [[TestStep alloc] init]; step1.providedFeature = @"feature_a"; @@ -346,7 +348,7 @@ } // Sync phase change with async tasks -TEST(PhasedStepRunnerTest, TestPhaseChangeInStepWithAsync) { +TEST_F(PhasedStepRunnerTest, TestPhaseChangeInStepWithAsync) { TestStep* step1 = [[AsyncTestStep alloc] init]; step1.providedFeature = @"feature_a";
diff --git a/ios/clean/chrome/browser/ui/adaptor/application_commands_adaptor.mm b/ios/clean/chrome/browser/ui/adaptor/application_commands_adaptor.mm index 1e032aa..99a75e2 100644 --- a/ios/clean/chrome/browser/ui/adaptor/application_commands_adaptor.mm +++ b/ios/clean/chrome/browser/ui/adaptor/application_commands_adaptor.mm
@@ -74,6 +74,10 @@ [self showAlert:@"showSignin"]; } +- (void)showAddAccount { + [self showAlert:@"showAddAccount"]; +} + #pragma mark - ApplicationSettingsCommands - (void)showAccountsSettings {
diff --git a/ios/clean/chrome/browser/ui/dialogs/context_menu/context_menu_dialog_mediator_unittest.mm b/ios/clean/chrome/browser/ui/dialogs/context_menu/context_menu_dialog_mediator_unittest.mm index 26f671d1..165d747 100644 --- a/ios/clean/chrome/browser/ui/dialogs/context_menu/context_menu_dialog_mediator_unittest.mm +++ b/ios/clean/chrome/browser/ui/dialogs/context_menu/context_menu_dialog_mediator_unittest.mm
@@ -12,14 +12,17 @@ #import "ios/web/public/web_state/context_menu_params.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #include "url/gurl.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif +using ContextMenuDialogMediatorTest = PlatformTest; + // Tests context menu setup for a request with no URLs. -TEST(ContextMenuDialogMediatorTest, NoURLs) { +TEST_F(ContextMenuDialogMediatorTest, NoURLs) { // Create a context with |kMenuTitle|. NSString* kMenuTitle = @"Menu Title"; web::ContextMenuParams params; @@ -39,7 +42,7 @@ } // Tests that the script button is shown for javacript: scheme URLs. -TEST(ContextMenuDialogMediatorTest, ScriptItem) { +TEST_F(ContextMenuDialogMediatorTest, ScriptItem) { // Create a context with |kJavaScriptURL|. GURL kJavaScriptURL("javascript:alert('test');"); web::ContextMenuParams params; @@ -56,7 +59,7 @@ } // Tests that the link options are shown for valid link URLs. -TEST(ContextMenuDialogMediatorTest, LinkItems) { +TEST_F(ContextMenuDialogMediatorTest, LinkItems) { // Create a context with a valid link URL. web::ContextMenuParams params; params.link_url = GURL("http://valid.url.com"); @@ -80,7 +83,7 @@ } // Tests that the image options are shown for valid image URLs. -TEST(ContextMenuDialogMediatorTest, ImageItems) { +TEST_F(ContextMenuDialogMediatorTest, ImageItems) { // Create a context with a valid image URL. web::ContextMenuParams params; params.src_url = GURL("http://valid.url.com");
diff --git a/ios/clean/chrome/browser/ui/dialogs/dialog_button_configuration_unittest.mm b/ios/clean/chrome/browser/ui/dialogs/dialog_button_configuration_unittest.mm index 114acf3e..bb294074 100644 --- a/ios/clean/chrome/browser/ui/dialogs/dialog_button_configuration_unittest.mm +++ b/ios/clean/chrome/browser/ui/dialogs/dialog_button_configuration_unittest.mm
@@ -8,6 +8,7 @@ #import "ios/clean/chrome/browser/ui/dialogs/dialog_configuration_identifier.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -19,9 +20,11 @@ const DialogButtonStyle kButtonStyle = DialogButtonStyle::DESTRUCTIVE; } +using DialogButtonConfigurationTest = PlatformTest; + // Tests that the values passed to the factory method are reflected in the // returned value. -TEST(DialogButtonConfigurationTest, FactoryMethod) { +TEST_F(DialogButtonConfigurationTest, FactoryMethod) { DialogButtonConfiguration* config = [DialogButtonConfiguration configWithText:kButtonText style:kButtonStyle]; EXPECT_NSEQ(kButtonText, config.text); @@ -30,7 +33,7 @@ // Tests that two DialogButtonConfigurations created with the same values have // unequal identifiers. -TEST(DialogButtonConfigurationTest, Identifiers) { +TEST_F(DialogButtonConfigurationTest, Identifiers) { DialogButtonConfiguration* config1 = [DialogButtonConfiguration configWithText:kButtonText style:kButtonStyle]; DialogButtonConfiguration* config2 =
diff --git a/ios/clean/chrome/browser/ui/dialogs/dialog_configuration_identifier_unittest.mm b/ios/clean/chrome/browser/ui/dialogs/dialog_configuration_identifier_unittest.mm index c14726a..4dcd2cf 100644 --- a/ios/clean/chrome/browser/ui/dialogs/dialog_configuration_identifier_unittest.mm +++ b/ios/clean/chrome/browser/ui/dialogs/dialog_configuration_identifier_unittest.mm
@@ -6,14 +6,17 @@ #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif +using DialogConfigurationIdentifierTest = PlatformTest; + // Tests that two DialogConfigurationIdentifiers created sequentially are not // equal to each other. -TEST(DialogConfigurationIdentifierTest, NotEqual) { +TEST_F(DialogConfigurationIdentifierTest, NotEqual) { DialogConfigurationIdentifier* ID1 = [[DialogConfigurationIdentifier alloc] init]; DialogConfigurationIdentifier* ID2 = @@ -23,7 +26,7 @@ // Tests that copying a DialogConfigurationIdentifier creates one that is equal // to the original. -TEST(DialogConfigurationIdentifierTest, EqualCopies) { +TEST_F(DialogConfigurationIdentifierTest, EqualCopies) { DialogConfigurationIdentifier* identifier = [[DialogConfigurationIdentifier alloc] init]; DialogConfigurationIdentifier* copy = [identifier copy];
diff --git a/ios/clean/chrome/browser/ui/dialogs/dialog_text_field_configuration_unittest.mm b/ios/clean/chrome/browser/ui/dialogs/dialog_text_field_configuration_unittest.mm index a39f90e..4afa494b 100644 --- a/ios/clean/chrome/browser/ui/dialogs/dialog_text_field_configuration_unittest.mm +++ b/ios/clean/chrome/browser/ui/dialogs/dialog_text_field_configuration_unittest.mm
@@ -7,6 +7,7 @@ #import "ios/clean/chrome/browser/ui/dialogs/dialog_configuration_identifier.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -19,9 +20,11 @@ const BOOL kSecure = YES; } +using DialogTextFieldConfigurationTest = PlatformTest; + // Tests that the values passed to the factory method are reflected in the // returned value. -TEST(DialogTextFieldConfigurationTest, FactoryMethod) { +TEST_F(DialogTextFieldConfigurationTest, FactoryMethod) { DialogTextFieldConfiguration* config = [DialogTextFieldConfiguration configWithDefaultText:kDefaultText placeholderText:kPlaceholderText @@ -33,7 +36,7 @@ // Tests that two DialogTextFieldConfigurations created with the same values // have unequal identifiers. -TEST(DialogTextFieldConfigurationTest, Identifiers) { +TEST_F(DialogTextFieldConfigurationTest, Identifiers) { DialogTextFieldConfiguration* config1 = [DialogTextFieldConfiguration configWithDefaultText:kDefaultText placeholderText:kPlaceholderText
diff --git a/ios/clean/chrome/browser/ui/dialogs/dialog_view_controller_unittest.mm b/ios/clean/chrome/browser/ui/dialogs/dialog_view_controller_unittest.mm index d9a2968f..3c842b6 100644 --- a/ios/clean/chrome/browser/ui/dialogs/dialog_view_controller_unittest.mm +++ b/ios/clean/chrome/browser/ui/dialogs/dialog_view_controller_unittest.mm
@@ -10,13 +10,16 @@ #import "ios/clean/chrome/browser/ui/dialogs/test_helpers/dialog_test_util.h" #import "ios/clean/chrome/browser/ui/dialogs/test_helpers/test_dialog_view_controller.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif +using DialogViewControllerTest = PlatformTest; + // Tests that the dialog is properly set up via the DialogConsumer API. -TEST(DialogViewControllerTest, VerifySetup) { +TEST_F(DialogViewControllerTest, VerifySetup) { NSString* const kTitle = @"Title"; NSString* const kMessage = @"message"; NSArray* const kButtonConfigs = @[ [DialogButtonConfiguration
diff --git a/ios/clean/chrome/browser/ui/dialogs/unavailable_feature_dialogs/unavailable_feature_dialog_mediator_unittest.mm b/ios/clean/chrome/browser/ui/dialogs/unavailable_feature_dialogs/unavailable_feature_dialog_mediator_unittest.mm index 9f90c39..93a63d9 100644 --- a/ios/clean/chrome/browser/ui/dialogs/unavailable_feature_dialogs/unavailable_feature_dialog_mediator_unittest.mm +++ b/ios/clean/chrome/browser/ui/dialogs/unavailable_feature_dialogs/unavailable_feature_dialog_mediator_unittest.mm
@@ -9,15 +9,18 @@ #import "ios/clean/chrome/browser/ui/dialogs/dialog_mediator+subclassing.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #include "url/gurl.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif +using UnavailableFeatureDialogMediatorTest = PlatformTest; + // Tests that an UnavailableFeatureDialogMediator correctly uses the feature // name as the message and has one OK button. -TEST(UnavailableFeatureDialogMediator, Simple) { +TEST_F(UnavailableFeatureDialogMediatorTest, Simple) { NSString* kFeatureName = @"Feature Name"; DialogMediator* mediator = [[UnavailableFeatureDialogMediator alloc] initWithFeatureName:kFeatureName];
diff --git a/ios/clean/chrome/browser/ui/root/root_coordinator_unittest.mm b/ios/clean/chrome/browser/ui/root/root_coordinator_unittest.mm index db6a92a3..83f7a7c 100644 --- a/ios/clean/chrome/browser/ui/root/root_coordinator_unittest.mm +++ b/ios/clean/chrome/browser/ui/root/root_coordinator_unittest.mm
@@ -6,6 +6,7 @@ #import "ios/clean/chrome/browser/url_opening.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -13,8 +14,10 @@ namespace { +using RootCoordinatorTest = PlatformTest; + // Tests that RootCoordinator conforms to the URLOpening protocol. -TEST(RootCoordinatorTest, TestConformsToURLOpening) { +TEST_F(RootCoordinatorTest, TestConformsToURLOpening) { EXPECT_TRUE([RootCoordinator conformsToProtocol:@protocol(URLOpening)]); }
diff --git a/ios/clean/chrome/browser/ui/transitions/animators/swap_from_above_animator_unittest.mm b/ios/clean/chrome/browser/ui/transitions/animators/swap_from_above_animator_unittest.mm index 60aa8a0..50b6495 100644 --- a/ios/clean/chrome/browser/ui/transitions/animators/swap_from_above_animator_unittest.mm +++ b/ios/clean/chrome/browser/ui/transitions/animators/swap_from_above_animator_unittest.mm
@@ -7,12 +7,15 @@ #import "base/test/ios/wait_util.h" #import "ios/clean/chrome/browser/ui/transitions/animators/test_transition_context.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif -TEST(SwapFromAboveAnimatorTest, AnimationCallsCompleteTransitionOnContext) { +using SwapFromAboveAnimatorTest = PlatformTest; + +TEST_F(SwapFromAboveAnimatorTest, AnimationCallsCompleteTransitionOnContext) { SwapFromAboveAnimator* animator = [[SwapFromAboveAnimator alloc] init]; TestTransitionContext* context = [[TestTransitionContext alloc] init];
diff --git a/ios/clean/chrome/browser/ui/transitions/containment_transition_context_unittest.mm b/ios/clean/chrome/browser/ui/transitions/containment_transition_context_unittest.mm index 3e901c5..0337f41 100644 --- a/ios/clean/chrome/browser/ui/transitions/containment_transition_context_unittest.mm +++ b/ios/clean/chrome/browser/ui/transitions/containment_transition_context_unittest.mm
@@ -5,6 +5,7 @@ #import "ios/clean/chrome/browser/ui/transitions/containment_transition_context.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -77,9 +78,11 @@ @end +using ContainmentTransitionContextTest = PlatformTest; + // Tests that the view controllers are properly returned by the context after // initialization. -TEST(ContainmentTransitionContextTest, InitializationChildViewControllers) { +TEST_F(ContainmentTransitionContextTest, InitializationChildViewControllers) { UIViewController* fromViewController = [[UIViewController alloc] init]; UIViewController* toViewController = [[UIViewController alloc] init]; UIViewController* parentViewController = [[UIViewController alloc] init]; @@ -108,7 +111,7 @@ // Tests that the container view is properly returned by the context after // initialization. -TEST(ContainmentTransitionContextTest, InitializationContainerView) { +TEST_F(ContainmentTransitionContextTest, InitializationContainerView) { UIView* containerView = [[UIView alloc] init]; ContainmentTransitionContext* context = [[ContainmentTransitionContext alloc] initWithFromViewController:nil @@ -122,7 +125,7 @@ // Tests that the view controllers receive the appropriate calls to perform a // containment transition when prepareTransitionWithAnimator: and // completeTransition: are called. -TEST(ContainmentTransitionContextTest, PrepareAndTransition) { +TEST_F(ContainmentTransitionContextTest, PrepareAndTransition) { TestViewController* fromViewController = [[TestViewController alloc] init]; TestViewController* toViewController = [[TestViewController alloc] init]; UIViewController* parentViewController = [[UIViewController alloc] init]; @@ -171,7 +174,7 @@ EXPECT_EQ(parentViewController, toViewController.didMoveToParentArgument); } -TEST(ContainmentTransitionContextTest, CompletionBlockCalledOnCompletion) { +TEST_F(ContainmentTransitionContextTest, CompletionBlockCalledOnCompletion) { __block NSUInteger count = 0; __block BOOL didComplete = NO; ContainmentTransitionContext* context = [[ContainmentTransitionContext alloc] @@ -188,7 +191,7 @@ EXPECT_EQ(YES, didComplete); } -TEST(ContainmentTransitionContextTest, CompletionBlockCalledOnCancellation) { +TEST_F(ContainmentTransitionContextTest, CompletionBlockCalledOnCancellation) { __block NSUInteger count = 0; __block BOOL didComplete = NO; ContainmentTransitionContext* context = [[ContainmentTransitionContext alloc] @@ -205,7 +208,7 @@ EXPECT_EQ(NO, didComplete); } -TEST(ContainmentTransitionContextTest, AnimationEndedCalledOnCompletion) { +TEST_F(ContainmentTransitionContextTest, AnimationEndedCalledOnCompletion) { ContainmentTransitionContext* context = [[ContainmentTransitionContext alloc] initWithFromViewController:nil toViewController:nil @@ -229,7 +232,7 @@ EXPECT_FALSE(animator.animateTransitionCalled); } -TEST(ContainmentTransitionContextTest, AnimationEndedCalledOnCancellation) { +TEST_F(ContainmentTransitionContextTest, AnimationEndedCalledOnCancellation) { ContainmentTransitionContext* context = [[ContainmentTransitionContext alloc] initWithFromViewController:nil toViewController:nil
diff --git a/ios/net/cookies/cookie_cache_unittest.cc b/ios/net/cookies/cookie_cache_unittest.cc index e1a8533..3665883 100644 --- a/ios/net/cookies/cookie_cache_unittest.cc +++ b/ios/net/cookies/cookie_cache_unittest.cc
@@ -7,6 +7,7 @@ #include "net/cookies/canonical_cookie.h" #include "net/cookies/cookie_constants.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" namespace net { @@ -25,7 +26,9 @@ } // namespace -TEST(CookieCacheTest, UpdateAddsCookieAllowsnullptr) { +using CookieCacheTest = PlatformTest; + +TEST_F(CookieCacheTest, UpdateAddsCookieAllowsnullptr) { CookieCache cache; const GURL test_url("http://www.google.com"); std::vector<CanonicalCookie> cookies; @@ -34,7 +37,7 @@ EXPECT_FALSE(cache.Update(test_url, "abc", cookies, nullptr, nullptr)); } -TEST(CookieCacheTest, UpdateAddsCookie) { +TEST_F(CookieCacheTest, UpdateAddsCookie) { CookieCache cache; const GURL test_url("http://www.google.com"); std::vector<CanonicalCookie> cookies; @@ -55,7 +58,7 @@ EXPECT_TRUE(changed.empty()); } -TEST(CookieCacheTest, UpdateAddsDistinctCookie) { +TEST_F(CookieCacheTest, UpdateAddsDistinctCookie) { CookieCache cache; const GURL test_url("http://www.google.com"); const GURL test_url_path("http://www.google.com/foo"); @@ -87,7 +90,7 @@ EXPECT_EQ(1U, changed.size()); } -TEST(CookieCacheTest, UpdateValueChanged) { +TEST_F(CookieCacheTest, UpdateValueChanged) { CookieCache cache; const GURL test_url("http://www.google.com"); std::vector<CanonicalCookie> cookies; @@ -108,7 +111,7 @@ EXPECT_EQ("ghi", changed[0].Value()); } -TEST(CookieCacheTest, UpdateDeletedCookie) { +TEST_F(CookieCacheTest, UpdateDeletedCookie) { CookieCache cache; const GURL test_url("http://www.google.com"); std::vector<CanonicalCookie> cookies; @@ -123,7 +126,7 @@ EXPECT_TRUE(changed.empty()); } -TEST(CookieCacheTest, UpdatePathChanged) { +TEST_F(CookieCacheTest, UpdatePathChanged) { CookieCache cache; const GURL test_url("http://www.google.com"); const GURL test_url_path("http://www.google.com/foo"); @@ -139,7 +142,7 @@ EXPECT_EQ(1U, changed.size()); } -TEST(CookieCacheTest, MultipleDomains) { +TEST_F(CookieCacheTest, MultipleDomains) { CookieCache cache; const GURL test_url_a("http://www.google.com"); const GURL test_url_b("http://test.google.com"); @@ -152,7 +155,7 @@ EXPECT_FALSE(cache.Update(test_url_b, "abc", cookies, nullptr, nullptr)); } -TEST(CookieCacheTest, MultipleNames) { +TEST_F(CookieCacheTest, MultipleNames) { CookieCache cache; const GURL cookieurl("http://google.com"); std::vector<CanonicalCookie> cookies;
diff --git a/ios/net/cookies/cookie_creation_time_manager_unittest.mm b/ios/net/cookies/cookie_creation_time_manager_unittest.mm index 9b1f4577..0fbeed16 100644 --- a/ios/net/cookies/cookie_creation_time_manager_unittest.mm +++ b/ios/net/cookies/cookie_creation_time_manager_unittest.mm
@@ -10,6 +10,7 @@ #include "base/ios/ios_util.h" #include "base/time/time.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -17,7 +18,7 @@ namespace net { -class CookieCreationTimeManagerTest : public testing::Test { +class CookieCreationTimeManagerTest : public PlatformTest { public: NSHTTPCookie* GetCookie(NSString* cookie_line) { NSArray* cookies = [NSHTTPCookie
diff --git a/ios/net/cookies/cookie_store_ios_persistent_unittest.mm b/ios/net/cookies/cookie_store_ios_persistent_unittest.mm index e96579bc..51b2f49 100644 --- a/ios/net/cookies/cookie_store_ios_persistent_unittest.mm +++ b/ios/net/cookies/cookie_store_ios_persistent_unittest.mm
@@ -16,6 +16,7 @@ #import "ios/net/cookies/cookie_store_ios_test_util.h" #include "net/cookies/cookie_store_unittest.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -52,7 +53,7 @@ // Test fixture to exercise net::CookieStoreIOSPersistent created with // TestPersistentCookieStore back-end and not synchronized with // SystemCookieStore. -class CookieStoreIOSPersistentTest : public testing::Test { +class CookieStoreIOSPersistentTest : public PlatformTest { public: CookieStoreIOSPersistentTest() : kTestCookieURL("http://foo.google.com/bar"),
diff --git a/ios/net/cookies/cookie_store_ios_unittest.mm b/ios/net/cookies/cookie_store_ios_unittest.mm index 39daf4c..b4f9dae 100644 --- a/ios/net/cookies/cookie_store_ios_unittest.mm +++ b/ios/net/cookies/cookie_store_ios_unittest.mm
@@ -21,6 +21,7 @@ #import "net/base/mac/url_conversions.h" #include "net/cookies/cookie_store_unittest.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -97,7 +98,7 @@ // Test fixture to exercise net::CookieStoreIOS created without backend and // synchronized with |[NSHTTPCookieStorage sharedHTTPCookieStorage]|. -class CookieStoreIOSTest : public testing::Test { +class CookieStoreIOSTest : public PlatformTest { public: CookieStoreIOSTest() : kTestCookieURLFooBar("http://foo.google.com/bar"), @@ -231,8 +232,7 @@ EXPECT_EQ(1U, cookies_changed_.size()); } -TEST(CookieStoreIOS, GetAllCookiesForURLAsync) { - base::MessageLoop loop; +TEST_F(CookieStoreIOSTest, GetAllCookiesForURLAsync) { const GURL kTestCookieURLFooBar("http://foo.google.com/bar"); ScopedTestingCookieStoreIOSClient scoped_cookie_store_ios_client( base::MakeUnique<TestCookieStoreIOSClient>());
diff --git a/ios/net/cookies/system_cookie_util_unittest.mm b/ios/net/cookies/system_cookie_util_unittest.mm index ab9bf3d..8e4f2cf 100644 --- a/ios/net/cookies/system_cookie_util_unittest.mm +++ b/ios/net/cookies/system_cookie_util_unittest.mm
@@ -11,6 +11,7 @@ #include "net/cookies/cookie_constants.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #include "url/gurl.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -60,7 +61,9 @@ } // namespace -TEST(CookieUtil, CanonicalCookieFromSystemCookie) { +using CookieUtil = PlatformTest; + +TEST_F(CookieUtil, CanonicalCookieFromSystemCookie) { base::Time creation_time = base::Time::Now(); base::Time expire_date = creation_time + base::TimeDelta::FromHours(2); NSDate* system_expire_date = @@ -106,7 +109,7 @@ EXPECT_TRUE(chrome_cookie.IsSecure()); } -TEST(CookieUtil, SystemCookieFromCanonicalCookie) { +TEST_F(CookieUtil, SystemCookieFromCanonicalCookie) { base::Time expire_date = base::Time::Now() + base::TimeDelta::FromHours(2); // Test various combinations of session, secure and httponly attributes. @@ -116,7 +119,7 @@ CheckSystemCookie(base::Time(), true, true); } -TEST(CookieUtil, SystemCookieFromBadCanonicalCookie) { +TEST_F(CookieUtil, SystemCookieFromBadCanonicalCookie) { // Generate a bad canonical cookie (value is invalid utf8). net::CanonicalCookie bad_canonical_cookie( kCookieName, kCookieValueInvalidUtf8, kCookieDomain, kCookiePath,
diff --git a/ios/net/http_response_headers_util_unittest.mm b/ios/net/http_response_headers_util_unittest.mm index ae64284..07b3b9b 100644 --- a/ios/net/http_response_headers_util_unittest.mm +++ b/ios/net/http_response_headers_util_unittest.mm
@@ -11,6 +11,7 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/sys_string_conversions.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -39,9 +40,11 @@ return all_headers_present; } +using HttpResponseHeadersUtilTest = PlatformTest; + // Tests that HttpResponseHeaders created from NSHTTPURLResponses successfully // copy over the status code and the header names and values. -TEST(HttpResponseHeadersUtilTest, CreateHeadersFromNSHTTPURLResponse) { +TEST_F(HttpResponseHeadersUtilTest, CreateHeadersFromNSHTTPURLResponse) { NSHTTPURLResponse* http_response = [[NSHTTPURLResponse alloc] initWithURL:[NSURL URLWithString:@"test.com"] statusCode:200
diff --git a/ios/net/nsurlrequest_util_unittest.mm b/ios/net/nsurlrequest_util_unittest.mm index fcd848ff..0cd7635 100644 --- a/ios/net/nsurlrequest_util_unittest.mm +++ b/ios/net/nsurlrequest_util_unittest.mm
@@ -5,6 +5,7 @@ #include "ios/net/nsurlrequest_util.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -12,9 +13,11 @@ namespace { +using NSURLRequestUtilTest = PlatformTest; + // Tests that FormatUrlRequestForLogging outputs the string in the form: // request:<url> request.mainDocURL:<mainDocumentURL>. -TEST(NSURLRequestUtilTest, FormatUrlRequestForLogging) { +TEST_F(NSURLRequestUtilTest, FormatUrlRequestForLogging) { NSMutableURLRequest* request = [[NSMutableURLRequest alloc] init]; request.URL = [NSURL URLWithString:@"http://www.google.com"]; request.mainDocumentURL = [NSURL URLWithString:@"http://www.google1.com"];
diff --git a/ios/net/protocol_handler_util_unittest.mm b/ios/net/protocol_handler_util_unittest.mm index ff386ec..10992f0a 100644 --- a/ios/net/protocol_handler_util_unittest.mm +++ b/ios/net/protocol_handler_util_unittest.mm
@@ -24,6 +24,7 @@ #include "net/url_request/url_request_test_util.h" #include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest_mac.h" +#include "testing/platform_test.h" #include "url/gurl.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -108,7 +109,7 @@ } }; -class ProtocolHandlerUtilTest : public testing::Test, +class ProtocolHandlerUtilTest : public PlatformTest, public URLRequest::Delegate { public: ProtocolHandlerUtilTest() : request_context_(new TestURLRequestContext) {
diff --git a/ios/net/url_scheme_util_unittest.mm b/ios/net/url_scheme_util_unittest.mm index b91a0de..7a96d9c4 100644 --- a/ios/net/url_scheme_util_unittest.mm +++ b/ios/net/url_scheme_util_unittest.mm
@@ -8,6 +8,7 @@ #include "base/macros.h" #import "testing/gtest_mac.h" +#include "testing/platform_test.h" #include "url/gurl.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -24,7 +25,9 @@ "chrome://settings", }; -TEST(URLSchemeUtilTest, NSURLHasDataScheme) { +using URLSchemeUtilTest = PlatformTest; + +TEST_F(URLSchemeUtilTest, NSURLHasDataScheme) { for (unsigned int i = 0; i < arraysize(kSchemeTestData); ++i) { const char* url = kSchemeTestData[i]; bool nsurl_result = UrlHasDataScheme(
diff --git a/ios/web/browser_state_unittest.cc b/ios/web/browser_state_unittest.cc index 435dc40..06a25b0 100644 --- a/ios/web/browser_state_unittest.cc +++ b/ios/web/browser_state_unittest.cc
@@ -7,6 +7,7 @@ #include "base/supports_user_data.h" #include "ios/web/public/test/fakes/test_browser_state.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" namespace { class TestSupportsUserData : public base::SupportsUserData { @@ -16,18 +17,20 @@ }; } // namespace -TEST(BrowserStateTest, FromSupportsUserData_NullPointer) { +using BrowserStateTest = PlatformTest; + +TEST_F(BrowserStateTest, FromSupportsUserData_NullPointer) { DCHECK_EQ(static_cast<web::BrowserState*>(nullptr), web::BrowserState::FromSupportsUserData(nullptr)); } -TEST(BrowserStateTest, FromSupportsUserData_NonBrowserState) { +TEST_F(BrowserStateTest, FromSupportsUserData_NonBrowserState) { TestSupportsUserData supports_user_data; DCHECK_EQ(static_cast<web::BrowserState*>(nullptr), web::BrowserState::FromSupportsUserData(&supports_user_data)); } -TEST(BrowserStateTest, FromSupportsUserData) { +TEST_F(BrowserStateTest, FromSupportsUserData) { web::TestBrowserState browser_state; DCHECK_EQ(&browser_state, web::BrowserState::FromSupportsUserData(&browser_state));
diff --git a/ios/web/history_state_util_unittest.mm b/ios/web/history_state_util_unittest.mm index 3321b6e..e5de52a 100644 --- a/ios/web/history_state_util_unittest.mm +++ b/ios/web/history_state_util_unittest.mm
@@ -9,6 +9,7 @@ #include "base/macros.h" #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" +#include "testing/platform_test.h" #include "url/gurl.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -23,7 +24,7 @@ std::string expectedUrl; }; -class HistoryStateUtilTest : public ::testing::Test { +class HistoryStateUtilTest : public PlatformTest { protected: static const struct TestEntry tests_[]; };
diff --git a/ios/web/net/cert_policy_unittest.cc b/ios/web/net/cert_policy_unittest.cc index 1f0bbeef..e8d7308 100644 --- a/ios/web/net/cert_policy_unittest.cc +++ b/ios/web/net/cert_policy_unittest.cc
@@ -8,10 +8,13 @@ #include "net/cert/x509_certificate.h" #include "net/test/test_certificate_data.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" namespace web { -TEST(CertPolicyTest, Policy) { +using CertPolicyTest = PlatformTest; + +TEST_F(CertPolicyTest, Policy) { scoped_refptr<net::X509Certificate> google_cert( net::X509Certificate::CreateFromBytes( reinterpret_cast<const char*>(google_der), sizeof(google_der)));
diff --git a/ios/web/net/request_group_util_unittest.mm b/ios/web/net/request_group_util_unittest.mm index d05953d1..dd25c6e 100644 --- a/ios/web/net/request_group_util_unittest.mm +++ b/ios/web/net/request_group_util_unittest.mm
@@ -8,14 +8,17 @@ #include <stddef.h> #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif +using RequestGroupUtilTest = PlatformTest; + // Checks that all newly generated groupID are unique and that there are no // duplicates. -TEST(RequestGroupUtilTest, RequestGroupID) { +TEST_F(RequestGroupUtilTest, RequestGroupID) { NSMutableSet* set = [[NSMutableSet alloc] init]; const size_t kGenerated = 2000; for (size_t i = 0; i < kGenerated; ++i) @@ -25,7 +28,7 @@ // Tests that the ExtractRequestGroupIDFromUserAgent function behaves as // intended. -TEST(RequestGroupUtilTest, ExtractRequestGroupIDFromUserAgent) { +TEST_F(RequestGroupUtilTest, ExtractRequestGroupIDFromUserAgent) { EXPECT_FALSE(web::ExtractRequestGroupIDFromUserAgent(nil)); EXPECT_FALSE(web::ExtractRequestGroupIDFromUserAgent( @"Lynx/2.8.1pre.9 libwww-FM/2.14"));
diff --git a/ios/web/net/web_http_protocol_handler_delegate_unittest.mm b/ios/web/net/web_http_protocol_handler_delegate_unittest.mm index 251bc48..33e2ad4 100644 --- a/ios/web/net/web_http_protocol_handler_delegate_unittest.mm +++ b/ios/web/net/web_http_protocol_handler_delegate_unittest.mm
@@ -16,6 +16,7 @@ #import "ios/web/public/web_client.h" #include "net/url_request/url_request_test_util.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #import "third_party/ocmock/OCMock/OCMock.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -50,7 +51,7 @@ } }; -class WebHTTPProtocolHandlerDelegateTest : public testing::Test { +class WebHTTPProtocolHandlerDelegateTest : public PlatformTest { public: WebHTTPProtocolHandlerDelegateTest() : context_getter_(new net::TestURLRequestContextGetter(
diff --git a/ios/web/payments/payment_request_unittest.cc b/ios/web/payments/payment_request_unittest.cc index 8ebaac6..6a5138b 100644 --- a/ios/web/payments/payment_request_unittest.cc +++ b/ios/web/payments/payment_request_unittest.cc
@@ -11,13 +11,16 @@ #include "base/strings/utf_string_conversions.h" #include "base/values.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" namespace web { // PaymentRequest parsing tests. +using PaymentRequestTest = PlatformTest; + // Tests that populating a PaymentRequest from an empty dictionary fails. -TEST(PaymentRequestTest, ParsingEmptyRequestDictionaryFails) { +TEST_F(PaymentRequestTest, ParsingEmptyRequestDictionaryFails) { PaymentRequest output_request; base::DictionaryValue request_dict; EXPECT_FALSE(output_request.FromDictionaryValue(request_dict)); @@ -25,7 +28,7 @@ // Tests that populating a PaymentRequest from a dictionary without all // required values fails. -TEST(PaymentRequestTest, ParsingPartiallyPopulatedRequestDictionaryFails) { +TEST_F(PaymentRequestTest, ParsingPartiallyPopulatedRequestDictionaryFails) { PaymentRequest expected_request; PaymentRequest output_request; base::DictionaryValue request_dict; @@ -58,7 +61,7 @@ // Tests that populating a PaymentRequest from a dictionary with all required // elements succeeds and produces the expected result. -TEST(PaymentRequestTest, ParsingFullyPopulatedRequestDictionarySucceeds) { +TEST_F(PaymentRequestTest, ParsingFullyPopulatedRequestDictionarySucceeds) { PaymentRequest expected_request; PaymentRequest output_request; base::DictionaryValue request_dict; @@ -127,7 +130,7 @@ // PaymentRequest serialization tests. // Tests that serializing a default PaymentResponse yields the expected result. -TEST(PaymentRequestTest, EmptyResponseDictionary) { +TEST_F(PaymentRequestTest, EmptyResponseDictionary) { base::DictionaryValue expected_value; expected_value.SetString("requestId", ""); @@ -146,7 +149,7 @@ // Tests that serializing a populated PaymentResponse yields the expected // result. -TEST(PaymentRequestTest, PopulatedResponseDictionary) { +TEST_F(PaymentRequestTest, PopulatedResponseDictionary) { base::DictionaryValue expected_value; std::unique_ptr<base::DictionaryValue> details(new base::DictionaryValue); @@ -226,7 +229,7 @@ // Tests that two payment options objects are not equal if their property values // differ and equal otherwise. -TEST(PaymentRequestTest, PaymentOptionsEquality) { +TEST_F(PaymentRequestTest, PaymentOptionsEquality) { PaymentOptions options1; PaymentOptions options2; EXPECT_EQ(options1, options2); @@ -265,7 +268,7 @@ // differ or one is missing a value present in the other, and equal otherwise. // Doesn't test all properties of child objects, relying instead on their // respective tests. -TEST(PaymentRequestTest, PaymentRequestEquality) { +TEST_F(PaymentRequestTest, PaymentRequestEquality) { PaymentRequest request1; PaymentRequest request2; EXPECT_EQ(request1, request2); @@ -332,7 +335,7 @@ // values differ or one is missing a value present in the other, and equal // otherwise. Doesn't test all properties of child objects, relying instead on // their respective tests. -TEST(PaymentRequestTest, PaymentResponseEquality) { +TEST_F(PaymentRequestTest, PaymentResponseEquality) { PaymentResponse response1; PaymentResponse response2; EXPECT_EQ(response1, response2);
diff --git a/ios/web/public/crw_session_certificate_policy_cache_storage_unittest.mm b/ios/web/public/crw_session_certificate_policy_cache_storage_unittest.mm index 696ba5f6..d9739566 100644 --- a/ios/web/public/crw_session_certificate_policy_cache_storage_unittest.mm +++ b/ios/web/public/crw_session_certificate_policy_cache_storage_unittest.mm
@@ -73,9 +73,11 @@ EXPECT_TRUE(CacheStoragesAreEqual(cache_storage_.get(), decoded)); } +using CRWSessionCertificateStorageTest = PlatformTest; + // Tests that unarchiving a CRWSessionCertificateStorage returns nil if the // certificate data does not correctly decode to a certificate. -TEST(CRWSessionCertificateStorageTest, InvalidCertData) { +TEST_F(CRWSessionCertificateStorageTest, InvalidCertData) { NSMutableData* data = [[NSMutableData alloc] init]; NSKeyedArchiver* archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data];
diff --git a/ios/web/public/origin_util_unittest.mm b/ios/web/public/origin_util_unittest.mm index ec49ff1..79be9f5 100644 --- a/ios/web/public/origin_util_unittest.mm +++ b/ios/web/public/origin_util_unittest.mm
@@ -7,6 +7,7 @@ #import <WebKit/WebKit.h> #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #include "url/gurl.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -29,8 +30,10 @@ namespace web { +using OriginUtilTest = PlatformTest; + // Tests calling GURLOriginWithWKSecurityOrigin with nil. -TEST(OriginUtilTest, GURLOriginWithNilWKSecurityOrigin) { +TEST_F(OriginUtilTest, GURLOriginWithNilWKSecurityOrigin) { GURL url(GURLOriginWithWKSecurityOrigin(nil)); EXPECT_FALSE(url.is_valid()); @@ -38,7 +41,7 @@ } // Tests calling GURLOriginWithWKSecurityOrigin with valid origin. -TEST(OriginUtilTest, GURLOriginWithValidWKSecurityOrigin) { +TEST_F(OriginUtilTest, GURLOriginWithValidWKSecurityOrigin) { WKSecurityOriginStub* origin = [[WKSecurityOriginStub alloc] init]; [origin setProtocol:@"http"]; [origin setHost:@"chromium.org"];
diff --git a/ios/web/public/referrer_util_unittest.cc b/ios/web/public/referrer_util_unittest.cc index 9da6fae..4661c095 100644 --- a/ios/web/public/referrer_util_unittest.cc +++ b/ios/web/public/referrer_util_unittest.cc
@@ -7,6 +7,7 @@ #include "base/macros.h" #include "ios/web/public/referrer.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #include "url/gurl.h" namespace { @@ -23,9 +24,11 @@ namespace web { +using ReferrerUtilTest = PlatformTest; + // Tests that no matter what the transition and policy, the result is always // stripped of things that should not be in a referrer (e.g., passwords). -TEST(ReferrerUtilTest, ReferrerSanitization) { +TEST_F(ReferrerUtilTest, ReferrerSanitization) { for (unsigned int source = 0; source < arraysize(kTestUrls); ++source) { for (unsigned int dest = 0; dest < arraysize(kTestUrls); ++dest) { for (unsigned int policy = 0; policy <= ReferrerPolicyLast; ++policy) { @@ -41,7 +44,7 @@ } // Tests that the Always policy works as expected. -TEST(ReferrerUtilTest, AlwaysPolicy) { +TEST_F(ReferrerUtilTest, AlwaysPolicy) { for (unsigned int source = 0; source < arraysize(kTestUrls); ++source) { for (unsigned int dest = 1; dest < arraysize(kTestUrls); ++dest) { GURL source_url(kTestUrls[source]); @@ -57,7 +60,7 @@ // Tests that the Default policy works as expected, and matches // NoReferrerWhenDowngrade. -TEST(ReferrerUtilTest, DefaultPolicy) { +TEST_F(ReferrerUtilTest, DefaultPolicy) { for (unsigned int source = 0; source < arraysize(kTestUrls); ++source) { for (unsigned int dest = 1; dest < arraysize(kTestUrls); ++dest) { GURL source_url(kTestUrls[source]); @@ -80,7 +83,7 @@ } // Tests that the Never policy works as expected. -TEST(ReferrerUtilTest, NeverPolicy) { +TEST_F(ReferrerUtilTest, NeverPolicy) { for (unsigned int source = 0; source < arraysize(kTestUrls); ++source) { for (unsigned int dest = 1; dest < arraysize(kTestUrls); ++dest) { GURL source_url(kTestUrls[source]); @@ -95,7 +98,7 @@ } // Tests that the Origin policy works as expected. -TEST(ReferrerUtilTest, OriginPolicy) { +TEST_F(ReferrerUtilTest, OriginPolicy) { for (unsigned int source = 0; source < arraysize(kTestUrls); ++source) { for (unsigned int dest = 1; dest < arraysize(kTestUrls); ++dest) { GURL source_url(kTestUrls[source]); @@ -110,7 +113,7 @@ } // Tests that the OriginWhenCrossOrigin policy works as expected. -TEST(ReferrerUtilTest, OriginWhenCrossOriginPolicy) { +TEST_F(ReferrerUtilTest, OriginWhenCrossOriginPolicy) { for (unsigned int source = 0; source < arraysize(kTestUrls); ++source) { for (unsigned int dest = 1; dest < arraysize(kTestUrls); ++dest) { GURL source_url(kTestUrls[source]); @@ -129,7 +132,7 @@ } // Tests that the same-origin policy works as expected. -TEST(ReferrerUtilTest, SameOriginPolicy) { +TEST_F(ReferrerUtilTest, SameOriginPolicy) { for (unsigned int source = 0; source < arraysize(kTestUrls); ++source) { for (unsigned int dest = 1; dest < arraysize(kTestUrls); ++dest) { GURL source_url(kTestUrls[source]); @@ -147,7 +150,7 @@ } // Tests that the strict-origin policy works as expected. -TEST(ReferrerUtilTest, StrictOriginPolicy) { +TEST_F(ReferrerUtilTest, StrictOriginPolicy) { for (unsigned int source = 0; source < arraysize(kTestUrls); ++source) { for (unsigned int dest = 1; dest < arraysize(kTestUrls); ++dest) { GURL source_url(kTestUrls[source]); @@ -166,7 +169,7 @@ } // Tests that the strict-origin-when-cross-origin policy works as expected. -TEST(ReferrerUtilTest, StrictOriginWhenCrossOriginPolicy) { +TEST_F(ReferrerUtilTest, StrictOriginWhenCrossOriginPolicy) { for (unsigned int source = 0; source < arraysize(kTestUrls); ++source) { for (unsigned int dest = 1; dest < arraysize(kTestUrls); ++dest) { GURL source_url(kTestUrls[source]); @@ -188,7 +191,7 @@ } // Tests that PolicyForNavigation gives the right values. -TEST(ReferrerUtilTest, PolicyForNavigation) { +TEST_F(ReferrerUtilTest, PolicyForNavigation) { // The request and destination URLs are unused in the current implementation, // so use a dummy value. GURL dummy_url; @@ -239,7 +242,7 @@ // Tests that all the strings corresponding to web::ReferrerPolicy values are // correctly handled. -TEST(ReferrerUtilTest, PolicyFromString) { +TEST_F(ReferrerUtilTest, PolicyFromString) { // The ordering here must match web::ReferrerPolicy; this makes the test // simpler, at the cost of needing to re-order if the enum is re-ordered. const char* const kPolicyStrings[] = {
diff --git a/ios/web/public/user_agent_unittest.mm b/ios/web/public/user_agent_unittest.mm index 3a1835d..615ff80 100644 --- a/ios/web/public/user_agent_unittest.mm +++ b/ios/web/public/user_agent_unittest.mm
@@ -5,6 +5,7 @@ #import "ios/web/public/user_agent.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -12,8 +13,10 @@ namespace web { +using UserAgentTest = PlatformTest; + // Tests conversions between UserAgentType values and their descriptions -TEST(UserAgentTest, UserAgentTypeDescription) { +TEST_F(UserAgentTest, UserAgentTypeDescription) { const std::string kMobileDescription("MOBILE"); const std::string kDesktopDescription("DESKTOP"); const std::string kNoneDescription("NONE");
diff --git a/ios/web/public/web_state/page_viewport_state_unittest.mm b/ios/web/public/web_state/page_viewport_state_unittest.mm index c2f6769..53945a0 100644 --- a/ios/web/public/web_state/page_viewport_state_unittest.mm +++ b/ios/web/public/web_state/page_viewport_state_unittest.mm
@@ -6,6 +6,7 @@ #include "base/macros.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #include "url/gurl.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -14,8 +15,10 @@ namespace web { +using ViewportLengthTest = PlatformTest; + // Verifies viewport length construction for "device-width" and "device-height". -TEST(ViewportLengthTest, DeviceDimension) { +TEST_F(ViewportLengthTest, DeviceDimension) { ViewportLength device_width(@"device-width"); EXPECT_TRUE(device_width.use_device_length()); EXPECT_TRUE(isnan(device_width.value())); @@ -25,21 +28,23 @@ } // Verifies viewport length construction for a hardcoded length value. -TEST(ViewportLengthTest, HardcodedDimension) { +TEST_F(ViewportLengthTest, HardcodedDimension) { ViewportLength hardcoded_length(@"1024.0"); EXPECT_FALSE(hardcoded_length.use_device_length()); EXPECT_EQ(1024.0, hardcoded_length.value()); } // Tests that malformed strings are handled correctly. -TEST(ViewportLengthTest, MalformedInput) { +TEST_F(ViewportLengthTest, MalformedInput) { ViewportLength length(@"malformed input"); EXPECT_FALSE(length.use_device_length()); EXPECT_TRUE(isnan(length.value())); } +using PageViewportStateTest = PlatformTest; + // Tests that a well-formed viewport tag is successfully parsed. -TEST(PageViewportStateTest, ValidInputParsing) { +TEST_F(PageViewportStateTest, ValidInputParsing) { NSString* const kViewportContent = @"width=device-width, initial-scale=1.0, minimum-scale=1.0," "maximum-scale=5.0,user-scalable=no"; @@ -53,7 +58,7 @@ } // Tests that malformed strings are handled correctly. -TEST(PageViewportStateTest, MalformedInput) { +TEST_F(PageViewportStateTest, MalformedInput) { NSString* const kViewportContent = @"width=, initial-scale=not a valid value,, maximum-scale = "; PageViewportState state(kViewportContent); @@ -64,7 +69,7 @@ } // Tests parsing of the user-scalable property. -TEST(PageViewportStateTest, UserScalableParsing) { +TEST_F(PageViewportStateTest, UserScalableParsing) { PageViewportState state(@"user-scalable=yes"); EXPECT_TRUE(state.user_scalable()); state = PageViewportState(@"user-scalable=1");
diff --git a/ios/web/service_manager_connection_impl_unittest.cc b/ios/web/service_manager_connection_impl_unittest.cc index f0a605e..b768683a 100644 --- a/ios/web/service_manager_connection_impl_unittest.cc +++ b/ios/web/service_manager_connection_impl_unittest.cc
@@ -12,6 +12,7 @@ #include "services/service_manager/public/interfaces/constants.mojom.h" #include "services/service_manager/public/interfaces/service_factory.mojom.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" namespace web { namespace { @@ -26,7 +27,9 @@ } // namespace -TEST(ServiceManagerConnectionImplTest, ServiceLaunchThreading) { +using ServiceManagerConnectionImplTest = PlatformTest; + +TEST_F(ServiceManagerConnectionImplTest, ServiceLaunchThreading) { TestWebThreadBundle thread_bundle( TestWebThreadBundle::Options::REAL_IO_THREAD); // base::MessageLoop message_loop;
diff --git a/ios/web/url_scheme_util_unittest.mm b/ios/web/url_scheme_util_unittest.mm index 46d605a..c1f171b 100644 --- a/ios/web/url_scheme_util_unittest.mm +++ b/ios/web/url_scheme_util_unittest.mm
@@ -7,6 +7,7 @@ #import <Foundation/Foundation.h> #import "testing/gtest_mac.h" +#include "testing/platform_test.h" #include "url/gurl.h" #if !defined(__has_feature) || !__has_feature(objc_arc) @@ -15,7 +16,9 @@ namespace web { -TEST(URLSchemeUtilTest, UrlHasWebScheme) { +using URLSchemeUtilTest = PlatformTest; + +TEST_F(URLSchemeUtilTest, UrlHasWebScheme) { EXPECT_TRUE(UrlHasWebScheme(GURL("http://foo.com"))); EXPECT_TRUE(UrlHasWebScheme(GURL("https://foo.com"))); EXPECT_TRUE(UrlHasWebScheme(GURL("data:text/html;charset=utf-8,Hello"))); @@ -23,7 +26,7 @@ EXPECT_FALSE(UrlHasWebScheme(GURL("chrome://settings"))); } -TEST(URLSchemeUtilTest, NSURLHasWebScheme) { +TEST_F(URLSchemeUtilTest, NSURLHasWebScheme) { EXPECT_TRUE(UrlHasWebScheme([NSURL URLWithString:@"http://foo.com"])); EXPECT_TRUE(UrlHasWebScheme([NSURL URLWithString:@"https://foo.com"])); EXPECT_TRUE(UrlHasWebScheme(
diff --git a/ios/web/url_util_unittest.cc b/ios/web/url_util_unittest.cc index 5dbf63e6..720c515 100644 --- a/ios/web/url_util_unittest.cc +++ b/ios/web/url_util_unittest.cc
@@ -5,10 +5,13 @@ #include "ios/web/public/url_util.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" namespace web { -TEST(URLUtilTest, GURLByRemovingRefFromGURL) { +using URLUtilTest = PlatformTest; + +TEST_F(URLUtilTest, GURLByRemovingRefFromGURL) { GURL url("http://foo.com/bar#baz"); EXPECT_EQ(GURL("http://foo.com/bar"), GURLByRemovingRefFromGURL(url)); }
diff --git a/ios/web/web_state/page_display_state_unittest.mm b/ios/web/web_state/page_display_state_unittest.mm index 730da6b..726673d 100644 --- a/ios/web/web_state/page_display_state_unittest.mm +++ b/ios/web/web_state/page_display_state_unittest.mm
@@ -7,14 +7,17 @@ #include "testing/gtest/include/gtest/gtest.h" #define EXPECT_NAN(value) EXPECT_NE(value, value) +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif +using PageDisplayStateTest = PlatformTest; + // Tests that the empty constructor creates an invalid PageDisplayState with all // NAN values. -TEST(PageDisplayStateTest, EmptyConstructor) { +TEST_F(PageDisplayStateTest, EmptyConstructor) { web::PageDisplayState state; EXPECT_NAN(state.scroll_state().offset_x()); EXPECT_NAN(state.scroll_state().offset_y()); @@ -26,7 +29,7 @@ // Tests that the constructor with input states correctly populates the display // state. -TEST(PageDisplayStateTest, StatesConstructor) { +TEST_F(PageDisplayStateTest, StatesConstructor) { web::PageScrollState scroll_state(0.0, 1.0); EXPECT_EQ(0.0, scroll_state.offset_x()); EXPECT_EQ(1.0, scroll_state.offset_y()); @@ -48,7 +51,7 @@ } // Tests the constructor with value inputs. -TEST(PageDisplayStateTest, ValuesConstructor) { +TEST_F(PageDisplayStateTest, ValuesConstructor) { web::PageDisplayState state(0.0, 1.0, 1.0, 5.0, 1.0); EXPECT_EQ(0.0, state.scroll_state().offset_x()); EXPECT_EQ(1.0, state.scroll_state().offset_y()); @@ -59,7 +62,7 @@ } // Tests converting between a PageDisplayState, its serialization, and back. -TEST(PageDisplayStateTest, Serialization) { +TEST_F(PageDisplayStateTest, Serialization) { web::PageDisplayState state(0.0, 1.0, 1.0, 5.0, 1.0); web::PageDisplayState new_state(state.GetSerialization()); EXPECT_EQ(state, new_state);
diff --git a/ios/web/web_state/session_certificate_policy_cache_storage_builder_unittest.mm b/ios/web/web_state/session_certificate_policy_cache_storage_builder_unittest.mm index ef424419..97141d63 100644 --- a/ios/web/web_state/session_certificate_policy_cache_storage_builder_unittest.mm +++ b/ios/web/web_state/session_certificate_policy_cache_storage_builder_unittest.mm
@@ -13,14 +13,17 @@ #include "net/test/test_data_directory.h" #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." #endif +using SessionCertificatePolicyCacheStorageBuilderTest = PlatformTest; + // Tests that creating a CRWSessionCertificateCacheStorage using BuildStorage() // populates the storage with the correct data. -TEST(SessionCertificatePolicyCacheStorageBuilderTest, BuildStorage) { +TEST_F(SessionCertificatePolicyCacheStorageBuilderTest, BuildStorage) { // Create a cache and populate it with an allowed cert. web::TestWebThreadBundle thread_bundle; web::SessionCertificatePolicyCacheImpl cache; @@ -43,8 +46,8 @@ // Tests that creating a SessionCertificatePolicyCache using // BuildSessionCertificatePolicyCache() creates the cache with the correct data. -TEST(SessionCertificatePolicyCacheStorageBuilderTest, - BuildSessionCertificatePolicyCache) { +TEST_F(SessionCertificatePolicyCacheStorageBuilderTest, + BuildSessionCertificatePolicyCache) { // Create the cert cache storage. scoped_refptr<net::X509Certificate> cert = net::ImportCertFromFile(net::GetTestCertsDirectory(), "ok_cert.pem");
diff --git a/ios/web/web_state/ui/crw_web_view_scroll_view_proxy_unittest.mm b/ios/web/web_state/ui/crw_web_view_scroll_view_proxy_unittest.mm index 8aeaebbb..a17d1e9 100644 --- a/ios/web/web_state/ui/crw_web_view_scroll_view_proxy_unittest.mm +++ b/ios/web/web_state/ui/crw_web_view_scroll_view_proxy_unittest.mm
@@ -8,6 +8,7 @@ #include "base/compiler_specific.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #import "third_party/ocmock/OCMock/OCMock.h" #include "third_party/ocmock/gtest_support.h" @@ -17,7 +18,7 @@ namespace { -class CRWWebViewScrollViewProxyTest : public ::testing::Test { +class CRWWebViewScrollViewProxyTest : public PlatformTest { protected: void SetUp() override { mockScrollView_ = [OCMockObject niceMockForClass:[UIScrollView class]];
diff --git a/ios/web/web_state/ui/web_view_js_utils_unittest.mm b/ios/web/web_state/ui/web_view_js_utils_unittest.mm index 42060026..e379e63 100644 --- a/ios/web/web_state/ui/web_view_js_utils_unittest.mm +++ b/ios/web/web_state/ui/web_view_js_utils_unittest.mm
@@ -9,6 +9,7 @@ #import "base/mac/bind_objc_block.h" #include "base/values.h" #include "testing/gtest/include/gtest/gtest.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -16,13 +17,15 @@ namespace web { +using WebViewJsUtilsTest = PlatformTest; + // Tests that ValueResultFromWKResult converts nil value to nullptr. -TEST(WebViewJsUtilsTest, ValueResultFromUndefinedWKResult) { +TEST_F(WebViewJsUtilsTest, ValueResultFromUndefinedWKResult) { EXPECT_FALSE(ValueResultFromWKResult(nil)); } // Tests that ValueResultFromWKResult converts string to Value::Type::STRING. -TEST(WebViewJsUtilsTest, ValueResultFromStringWKResult) { +TEST_F(WebViewJsUtilsTest, ValueResultFromStringWKResult) { std::unique_ptr<base::Value> value(web::ValueResultFromWKResult(@"test")); EXPECT_TRUE(value); EXPECT_EQ(base::Value::Type::STRING, value->GetType()); @@ -34,7 +37,7 @@ // Tests that ValueResultFromWKResult converts inetger to Value::Type::DOUBLE. // NOTE: WKWebView API returns all numbers as kCFNumberFloat64Type, so there is // no way to tell if the result is integer or double. -TEST(WebViewJsUtilsTest, ValueResultFromIntegerWKResult) { +TEST_F(WebViewJsUtilsTest, ValueResultFromIntegerWKResult) { std::unique_ptr<base::Value> value(web::ValueResultFromWKResult(@1)); EXPECT_TRUE(value); EXPECT_EQ(base::Value::Type::DOUBLE, value->GetType()); @@ -44,7 +47,7 @@ } // Tests that ValueResultFromWKResult converts double to Value::Type::DOUBLE. -TEST(WebViewJsUtilsTest, ValueResultFromDoubleWKResult) { +TEST_F(WebViewJsUtilsTest, ValueResultFromDoubleWKResult) { std::unique_ptr<base::Value> value(web::ValueResultFromWKResult(@3.14)); EXPECT_TRUE(value); EXPECT_EQ(base::Value::Type::DOUBLE, value->GetType()); @@ -54,7 +57,7 @@ } // Tests that ValueResultFromWKResult converts bool to Value::Type::BOOLEAN. -TEST(WebViewJsUtilsTest, ValueResultFromBoolWKResult) { +TEST_F(WebViewJsUtilsTest, ValueResultFromBoolWKResult) { std::unique_ptr<base::Value> value(web::ValueResultFromWKResult(@YES)); EXPECT_TRUE(value); EXPECT_EQ(base::Value::Type::BOOLEAN, value->GetType()); @@ -64,7 +67,7 @@ } // Tests that ValueResultFromWKResult converts null to Value::Type::NONE. -TEST(WebViewJsUtilsTest, ValueResultFromNullWKResult) { +TEST_F(WebViewJsUtilsTest, ValueResultFromNullWKResult) { std::unique_ptr<base::Value> value( web::ValueResultFromWKResult([NSNull null])); EXPECT_TRUE(value); @@ -73,7 +76,7 @@ // Tests that ValueResultFromWKResult converts NSDictionaries to properly // initialized base::DictionaryValue. -TEST(WebViewJsUtilsTest, ValueResultFromDictionaryWKResult) { +TEST_F(WebViewJsUtilsTest, ValueResultFromDictionaryWKResult) { NSDictionary* test_dictionary = @{ @"Key1" : @"Value1", @"Key2" : @{@"Key3" : @42} }; @@ -99,7 +102,7 @@ // Tests that ValueResultFromWKResult converts NSArray to properly // initialized base::ListValue. -TEST(WebViewJsUtilsTest, ValueResultFromArrayWKResult) { +TEST_F(WebViewJsUtilsTest, ValueResultFromArrayWKResult) { NSArray* test_array = @[ @"Value1", @[ @YES ], @42 ]; std::unique_ptr<base::Value> value(web::ValueResultFromWKResult(test_array)); @@ -124,7 +127,7 @@ } // Tests that an NSDictionary with a cycle does not cause infinite recursion. -TEST(WebViewJsUtilsTest, ValueResultFromDictionaryWithDepthCheckWKResult) { +TEST_F(WebViewJsUtilsTest, ValueResultFromDictionaryWithDepthCheckWKResult) { // Create a dictionary with a cycle. NSMutableDictionary* test_dictionary = [NSMutableDictionary dictionaryWithCapacity:1]; @@ -162,7 +165,7 @@ } // Tests that an NSArray with a cycle does not cause infinite recursion. -TEST(WebViewJsUtilsTest, ValueResultFromArrayWithDepthCheckWKResult) { +TEST_F(WebViewJsUtilsTest, ValueResultFromArrayWithDepthCheckWKResult) { // Create an array with a cycle. NSMutableArray* test_array = [NSMutableArray arrayWithCapacity:1]; NSMutableArray* test_array_2 = [NSMutableArray arrayWithCapacity:1];
diff --git a/ios/web_view/internal/cwv_html_element_unittest.mm b/ios/web_view/internal/cwv_html_element_unittest.mm index 55768ee..eec4910 100644 --- a/ios/web_view/internal/cwv_html_element_unittest.mm +++ b/ios/web_view/internal/cwv_html_element_unittest.mm
@@ -8,6 +8,7 @@ #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -15,8 +16,10 @@ namespace ios_web_view { +using CWVHTMLElementTest = PlatformTest; + // Tests CWVHTMLElementTest initialization. -TEST(CWVHTMLElementTest, Initialization) { +TEST_F(CWVHTMLElementTest, Initialization) { NSURL* const hyperlink = [NSURL URLWithString:@"https://chromium.test"]; NSURL* const mediaSource = [NSURL URLWithString:@"https://chromium/img.webp"]; NSString* const text = @"link";
diff --git a/ios/web_view/internal/cwv_preview_element_info_unittest.mm b/ios/web_view/internal/cwv_preview_element_info_unittest.mm index 8f1a7b7..eab981e7 100644 --- a/ios/web_view/internal/cwv_preview_element_info_unittest.mm +++ b/ios/web_view/internal/cwv_preview_element_info_unittest.mm
@@ -6,6 +6,7 @@ #include "testing/gtest/include/gtest/gtest.h" #import "testing/gtest_mac.h" +#include "testing/platform_test.h" #if !defined(__has_feature) || !__has_feature(objc_arc) #error "This file requires ARC support." @@ -13,8 +14,10 @@ namespace ios_web_view { +using CWVPreviewElementInfoTest = PlatformTest; + // Tests CWVPreviewElementInfoTest initialization. -TEST(CWVPreviewElementInfoTest, Initialization) { +TEST_F(CWVPreviewElementInfoTest, Initialization) { NSURL* const linkURL = [NSURL URLWithString:@"https://chromium.test"]; CWVPreviewElementInfo* element = [[CWVPreviewElementInfo alloc] initWithLinkURL:linkURL];
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/descriptor-not-found.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/descriptor-not-found.html index d8826a3f..9982902 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/descriptor-not-found.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptor/descriptor-not-found.html
@@ -5,7 +5,7 @@ <script> 'use strict'; let descriptorUUID = '00002906-0000-1000-8000-00805f9b34fb'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/blocklisted-descriptors-not-present.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/blocklisted-descriptors-not-present.html index bf0fef1..db5ce35 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/blocklisted-descriptors-not-present.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/getDescriptors/blocklisted-descriptors-not-present.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { // DisconnectingHealthThermometerAdapter's measurement_interval contains // one blocklisted descriptor. Make sure that it isn't returned in the result // of getDescriptors().
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/add-listener-after-promise.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/add-listener-after-promise.html index e7ec0ef2..9fae0051 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/add-listener-after-promise.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/add-listener-after-promise.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/add-multiple-event-listeners.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/add-multiple-event-listeners.html index 8234183..e3157a35 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/add-multiple-event-listeners.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/add-multiple-event-listeners.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { let char; return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/characteristic-does-not-support-notifications.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/characteristic-does-not-support-notifications.html index 366870a..423ee67 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/characteristic-does-not-support-notifications.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/characteristic-does-not-support-notifications.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/characteristic-is-removed.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/characteristic-is-removed.html index 21636b2..8e707ab 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/characteristic-is-removed.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/characteristic-is-removed.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/concurrent-starts-and-receive-notification.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/concurrent-starts-and-receive-notification.html index cdc3453..0533632 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/concurrent-starts-and-receive-notification.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/concurrent-starts-and-receive-notification.html
@@ -5,7 +5,7 @@ <script> 'use strict'; let char; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/concurrent-starts.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/concurrent-starts.html index 534a3ce..d9ad7ed 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/concurrent-starts.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/concurrent-starts.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/concurrent-stops.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/concurrent-stops.html index da19a901..16906a5 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/concurrent-stops.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/concurrent-stops.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/device-goes-out-of-range.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/device-goes-out-of-range.html index e1c911e..abd33cc 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/device-goes-out-of-range.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/device-goes-out-of-range.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/event-after-starting.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/event-after-starting.html index f9242e4..e9fb075f 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/event-after-starting.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/event-after-starting.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/gc-with-pending-start.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/gc-with-pending-start.html index 7dcade9e..7b51df2 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/gc-with-pending-start.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/gc-with-pending-start.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { let start_promise; return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/gc-with-pending-stop.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/gc-with-pending-stop.html index 8a993b84..2e6b6d52 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/gc-with-pending-stop.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/gc-with-pending-stop.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { let stop_promise; return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/notification-after-disconnection.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/notification-after-disconnection.html index 38579420..c2671353 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/notification-after-disconnection.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/notification-after-disconnection.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { // The iframe we create will subscribe to notifications and will ensure // that the browser keeps receiving notifications even after this frame's // device disconnects.
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/parallel-start-stop.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/parallel-start-stop.html index 7805581..9efccb2 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/parallel-start-stop.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/parallel-start-stop.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/service-is-removed.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/service-is-removed.html index a0ed18c..36f4620 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/service-is-removed.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/service-is-removed.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/start-before-stop-resolves.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/start-before-stop-resolves.html index 1c3a043..5bbcb8d 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/start-before-stop-resolves.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/start-before-stop-resolves.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/start-fails.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/start-fails.html index 481f71a4..516b646 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/start-fails.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/start-fails.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('FailingGATTOperationsAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: [errorUUID(0xA0)]}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/start-stop-start-stop.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/start-stop-start-stop.html index f7f72ea..7d11a71 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/start-stop-start-stop.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/start-stop-start-stop.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/start-succeeds.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/start-succeeds.html index b7118db..819c611 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/start-succeeds.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/start-succeeds.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/start-twice-in-a-row.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/start-twice-in-a-row.html index cf083e5f..15cae05 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/start-twice-in-a-row.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/start-twice-in-a-row.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/stop-after-start-succeeds.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/stop-after-start-succeeds.html index addc682..33623dd6 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/stop-after-start-succeeds.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/stop-after-start-succeeds.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/stop-twice.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/stop-twice.html index 05c553c..25f5c06 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/stop-twice.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/stop-twice.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/stop-without-starting.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/stop-without-starting.html index 2635417e4..3cde45e7 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/stop-without-starting.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/notifications/stop-without-starting.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/add-multiple-event-listeners.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/add-multiple-event-listeners.html index daa6f0e..c6c39ffa 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/add-multiple-event-listeners.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/add-multiple-event-listeners.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return getMeasurementIntervalCharacteristic() .then(({characteristic, fake_characteristic}) => { return fake_characteristic.setNextReadResponse(GATT_SUCCESS, [0,1,2])
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/blocklisted-characteristic.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/blocklisted-characteristic.html index 8e76559..0f63d805 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/blocklisted-characteristic.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/blocklisted-characteristic.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('BlocklistTestAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: [blocklist_test_service_uuid]}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/characteristic-is-removed.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/characteristic-is-removed.html index 4f338a2..840a915 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/characteristic-is-removed.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/characteristic-is-removed.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/device-goes-out-of-range.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/device-goes-out-of-range.html index 85d73864..9bca1dd 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/device-goes-out-of-range.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/device-goes-out-of-range.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/event-is-fired.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/event-is-fired.html index f734da6..0a1f0dc 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/event-is-fired.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/event-is-fired.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return getMeasurementIntervalCharacteristic() .then(({characteristic, fake_characteristic}) => { return fake_characteristic.setNextReadResponse(GATT_SUCCESS, [0, 1, 2])
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/read-fails.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/read-fails.html index 209bef3..84e6fd27 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/read-fails.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/read-fails.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('FailingGATTOperationsAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: [errorUUID(0xA0)]}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/read-succeeds.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/read-succeeds.html index a060e6f..d0171b5 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/read-succeeds.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/read-succeeds.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { const EXPECTED_VALUE = [0, 1, 2]; return getMeasurementIntervalCharacteristic() .then(({characteristic, fake_characteristic}) => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/read-updates-value.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/read-updates-value.html index 64fd984..68752def 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/read-updates-value.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/read-updates-value.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { const EXPECTED_VALUE = [0, 1, 2]; return getMeasurementIntervalCharacteristic() .then(({characteristic, fake_characteristic}) => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/service-is-removed.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/service-is-removed.html index 1bd5f35..49d9433 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/service-is-removed.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/readValue/service-is-removed.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/device-reconnects-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/device-reconnects-during-success.html index ff8d0f9..74a00f6 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/device-reconnects-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/device-reconnects-during-success.html
@@ -4,7 +4,7 @@ <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> -bluetooth_test(() => { +promise_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingDuringStopNotifySessionAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/reconnect-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/reconnect-during-success.html index f65bedc..41b4129a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/reconnect-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/stopNotifications/reconnect-during-success.html
@@ -4,7 +4,7 @@ <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> -bluetooth_test(() => { +promise_test(() => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('StopNotifySessionFinishesAfterReconnectionAdapter') .then(() => requestDeviceWithKeyDown({
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/blocklisted-characteristic.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/blocklisted-characteristic.html index 67c6093..4f354ac 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/blocklisted-characteristic.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/blocklisted-characteristic.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('BlocklistTestAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: [blocklist_test_service_uuid]}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/characteristic-is-removed.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/characteristic-is-removed.html index cb961ea..b7400f8 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/characteristic-is-removed.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/characteristic-is-removed.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/device-goes-out-of-range.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/device-goes-out-of-range.html index 2d2e0d0..5f10320 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/device-goes-out-of-range.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/device-goes-out-of-range.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/service-is-removed.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/service-is-removed.html index 5504b12..e0e2f50 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/service-is-removed.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/service-is-removed.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/value-too-long.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/value-too-long.html index d9ef7e2..e806ad7 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/value-too-long.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/value-too-long.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/write-fails.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/write-fails.html index 758f63f..72abaca 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/write-fails.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/write-fails.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('FailingGATTOperationsAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: [errorUUID(0xA0)]}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/write-succeeds.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/write-succeeds.html index 54168d3..8ca0dfa 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/write-succeeds.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/write-succeeds.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { let typed_array = Uint8Array.of(1, 2); let array_buffer = Uint8Array.of(3, 4).buffer; let data_view = new DataView(new ArrayBuffer(2));
diff --git a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/write-updates-value.html b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/write-updates-value.html index 618e2c33..fd8e19bc 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/write-updates-value.html +++ b/third_party/WebKit/LayoutTests/bluetooth/characteristic/writeValue/write-updates-value.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/descriptor-is-blocklisted.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/descriptor-is-blocklisted.html index 3ec13e0..3964edb 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/descriptor-is-blocklisted.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/descriptor-is-blocklisted.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test( +promise_test( () => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/read-succeeds.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/read-succeeds.html index 935c0a1..093f39a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/read-succeeds.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/read-succeeds.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { const EXPECTED_VALUE = [0, 1, 2]; return getUserDescriptionDescriptor() .then(({descriptor, fake_descriptor}) => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/read-updates-value.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/read-updates-value.html index 304abbe..811f074 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/read-updates-value.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/readValue/read-updates-value.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/descriptor-is-blocklisted.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/descriptor-is-blocklisted.html index 3f88edc..bec0a26ad 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/descriptor-is-blocklisted.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/descriptor-is-blocklisted.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test( +promise_test( () => { let val = new Uint8Array([1]); return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/value-too-long.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/value-too-long.html index 67b2226..3e25af42 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/value-too-long.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/value-too-long.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/write-succeeds.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/write-succeeds.html index 3edbbb2..e741cb6ae 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/write-succeeds.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/write-succeeds.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { let length = 1; let descriptor; return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/write-updates-value.html b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/write-updates-value.html index 84a148f..cf4706e 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/write-updates-value.html +++ b/third_party/WebKit/LayoutTests/bluetooth/descriptor/writeValue/write-updates-value.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/device/gattserverdisconnected-event/disconnected.html b/third_party/WebKit/LayoutTests/bluetooth/device/gattserverdisconnected-event/disconnected.html index 46c5450f..ae697ac 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/device/gattserverdisconnected-event/disconnected.html +++ b/third_party/WebKit/LayoutTests/bluetooth/device/gattserverdisconnected-event/disconnected.html
@@ -2,12 +2,14 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; let test_desc = 'A device disconnecting while connected should fire the ' + 'gattserverdisconnected event.'; let device, fake_peripheral; -bluetooth_test(() => getHealthThermometerDevice() +promise_test(() => getHealthThermometerDevice() .then(_ => ({device, fake_peripheral} = _)) .then(() => { fake_peripheral.simulateGATTDisconnection();
diff --git a/third_party/WebKit/LayoutTests/bluetooth/device/gattserverdisconnected-event/disconnected_gc.html b/third_party/WebKit/LayoutTests/bluetooth/device/gattserverdisconnected-event/disconnected_gc.html index 3761a57..36966d4 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/device/gattserverdisconnected-event/disconnected_gc.html +++ b/third_party/WebKit/LayoutTests/bluetooth/device/gattserverdisconnected-event/disconnected_gc.html
@@ -2,12 +2,14 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; let test_desc = 'A device disconnecting after the BluetoothDevice object has ' + 'been gced should not access freed memory.'; let fake_peripheral; -bluetooth_test(() => getHealthThermometerDevice() +promise_test(() => getHealthThermometerDevice() .then(_ => ({fake_peripheral} = _)) .then(() => { // 1. Disconnect.
diff --git a/third_party/WebKit/LayoutTests/bluetooth/device/gattserverdisconnected-event/one-event-per-disconnection.html b/third_party/WebKit/LayoutTests/bluetooth/device/gattserverdisconnected-event/one-event-per-disconnection.html index fb052f1..35d1fcb 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/device/gattserverdisconnected-event/one-event-per-disconnection.html +++ b/third_party/WebKit/LayoutTests/bluetooth/device/gattserverdisconnected-event/one-event-per-disconnection.html
@@ -2,6 +2,8 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; let test_desc = 'If a site disconnects from a device while the platform is ' + @@ -9,7 +11,7 @@ 'fire.'; let device, fake_peripheral; let num_events = 0; -bluetooth_test(() => getHealthThermometerDevice() +promise_test(() => getHealthThermometerDevice() .then(_ => ({device, fake_peripheral} = _)) // 1. Listen for disconnections. .then(() =>
diff --git a/third_party/WebKit/LayoutTests/bluetooth/device/gattserverdisconnected-event/reconnect-during-disconnected-event.html b/third_party/WebKit/LayoutTests/bluetooth/device/gattserverdisconnected-event/reconnect-during-disconnected-event.html index ec6133e..0c4ff44 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/device/gattserverdisconnected-event/reconnect-during-disconnected-event.html +++ b/third_party/WebKit/LayoutTests/bluetooth/device/gattserverdisconnected-event/reconnect-during-disconnected-event.html
@@ -2,13 +2,15 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; let test_desc = 'A device that reconnects during the gattserverdisconnected ' + 'event should still receive gattserverdisconnected events after ' + 're-connection.'; let device, fake_peripheral; -bluetooth_test(() => getHealthThermometerDevice() +promise_test(() => getHealthThermometerDevice() .then(_ => ({device, fake_peripheral} = _)) // 1. Disconnect. .then(() => new Promise(resolve => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/acceptAllDevices/device-with-empty-name.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/acceptAllDevices/device-with-empty-name.html index 4e87479b..b64594f9 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/acceptAllDevices/device-with-empty-name.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/acceptAllDevices/device-with-empty-name.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setUpPreconnectedDevice({name: ''}) .then(() => requestDeviceWithKeyDown({acceptAllDevices: true})) .then(device => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/acceptAllDevices/device-with-name.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/acceptAllDevices/device-with-name.html index 6f162b5..91e2ca4 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/acceptAllDevices/device-with-name.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/acceptAllDevices/device-with-name.html
@@ -2,8 +2,10 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> <script> -bluetooth_test(() => { +promise_test(() => { let device_name = 'LE Device'; return setUpPreconnectedDevice({name: device_name}) .then(() => requestDeviceWithKeyDown({acceptAllDevices: true}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/acceptAllDevices/device-with-no-name.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/acceptAllDevices/device-with-no-name.html index 6304ab8..9cb42a77 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/acceptAllDevices/device-with-no-name.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/acceptAllDevices/device-with-no-name.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('NoNameDeviceAdapter') .then(() => requestDeviceWithKeyDown({acceptAllDevices: true})) .then(device => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/acceptAllDevices/device-with-uuids.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/acceptAllDevices/device-with-uuids.html index e044df48..8bca279 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/acceptAllDevices/device-with-uuids.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/acceptAllDevices/device-with-uuids.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('NoNameHeartRateAdapter') .then(() => requestDeviceWithKeyDown({acceptAllDevices: true})) .then(device => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/acceptAllDevices/optional-services-missing.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/acceptAllDevices/optional-services-missing.html index a889d707..1aef3568 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/acceptAllDevices/optional-services-missing.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/acceptAllDevices/optional-services-missing.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return getHealthThermometerDevice({acceptAllDevices: true}) .then(({device}) => assert_promise_rejects_with_message( device.gatt.getPrimaryServices(),
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/acceptAllDevices/optional-services-present.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/acceptAllDevices/optional-services-present.html index a11599ff..96a7d46 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/acceptAllDevices/optional-services-present.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/acceptAllDevices/optional-services-present.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('TwoHeartRateServicesAdapter') .then(() => requestDeviceWithKeyDown({ acceptAllDevices: true,
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/device-name-longer-than-29-bytes.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/device-name-longer-than-29-bytes.html index 05687015..92426f6 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/device-name-longer-than-29-bytes.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/device-name-longer-than-29-bytes.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { const DEVICE_NAME = 'a_device_name_that_is_longer_than_29_bytes_but_shorter_than_248_bytes'; return setUpPreconnectedDevice({name: DEVICE_NAME})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/empty-filter.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/empty-filter.html index f6c1aaaf..1287c7f 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/empty-filter.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/empty-filter.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(t => { +promise_test(t => { return promise_rejects(t, new TypeError(), requestDeviceWithKeyDown({filters: [{}]})); }, 'A filter must restrict the devices in some way.'); </script>
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/empty-filters-member.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/empty-filters-member.html index 7baf250..4d940a7 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/empty-filters-member.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/empty-filters-member.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return assert_promise_rejects_with_message( requestDeviceWithKeyDown({filters: []}), new TypeError('Failed to execute \'requestDevice\' on \'Bluetooth\': ' +
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/empty-namePrefix.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/empty-namePrefix.html index 57a57a9..2e5d5d5 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/empty-namePrefix.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/empty-namePrefix.html
@@ -26,7 +26,7 @@ optionalServices: ['heart_rate'] }]; -bluetooth_test(t => { +promise_test(t => { let test_promises = Promise.resolve(); test_specs.forEach(args => { test_promises = test_promises
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/empty-services-member.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/empty-services-member.html index 1447f4a3..e1a6924 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/empty-services-member.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/empty-services-member.html
@@ -3,7 +3,7 @@ <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> -bluetooth_test(t => { +promise_test(t => { let test_promises = Promise.resolve(); generateRequestDeviceArgsWithServices([]).forEach(args => { test_promises = test_promises.then(() => promise_rejects(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/filters-xor-acceptAllDevices.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/filters-xor-acceptAllDevices.html index 6b23a0e3..fc817ee 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/filters-xor-acceptAllDevices.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/filters-xor-acceptAllDevices.html
@@ -11,7 +11,7 @@ {filters: [], acceptAllDevices: true, optionalServices: ['heart_rate']} ]; -bluetooth_test(t => { +promise_test(t => { let test_promises = Promise.resolve(); test_specs.forEach(args => { test_promises = test_promises
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-exceeded-name-unicode.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-exceeded-name-unicode.html index 1f8df98..888be30d 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-exceeded-name-unicode.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-exceeded-name-unicode.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { // \u2764's UTF-8 respresentation is 3 bytes long. // 83 chars * 3 bytes/char = 249 bytes const unicode_name = '\u2764'.repeat(83);
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-exceeded-name.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-exceeded-name.html index 32b00c83..db84c0b3 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-exceeded-name.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-exceeded-name.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { const name_too_long = 'a'.repeat(249); return assert_promise_rejects_with_message( requestDeviceWithKeyDown({filters: [{name: name_too_long}]}),
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-exceeded-namePrefix-unicode.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-exceeded-namePrefix-unicode.html index 37e9ee0..115ebe8b 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-exceeded-namePrefix-unicode.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-exceeded-namePrefix-unicode.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { // \u2764's UTF-8 respresentation is 3 bytes long. // 83 chars * 3 bytes/char = 249 bytes const unicode_name = '\u2764'.repeat(83);
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-exceeded-namePrefix.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-exceeded-namePrefix.html index aeb4cf7..1cd5af9 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-exceeded-namePrefix.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-exceeded-namePrefix.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { const name_too_long = 'a'.repeat(249); return assert_promise_rejects_with_message( requestDeviceWithKeyDown({filters: [{namePrefix: name_too_long}]}),
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-name-unicode.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-name-unicode.html index 7acc6d3..a5ed8b4 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-name-unicode.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-name-unicode.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { // \u00A1's UTF-8 respresentation is 2 bytes long. // 124 chars * 2 bytes/char = 248 bytes const DEVICE_NAME = '\u00A1'.repeat(124);
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-name.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-name.html index 88be3b2..a6f5f1d 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-name.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-name.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { const DEVICE_NAME = 'a'.repeat(248); return setUpPreconnectedDevice({name: DEVICE_NAME})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-namePrefix-unicode.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-namePrefix-unicode.html index c09c728..de56c4a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-namePrefix-unicode.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-namePrefix-unicode.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { // \u00A1's UTF-8 respresentation is 2 bytes long. // 124 chars * 2 bytes/char = 248 bytes const DEVICE_NAME = '\u00A1'.repeat(124);
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-namePrefix.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-namePrefix.html index a3e9b776..b84bcada 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-namePrefix.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/max-length-namePrefix.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { const DEVICE_NAME = 'a'.repeat(248); return setUpPreconnectedDevice({name: DEVICE_NAME})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/no-arguments.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/no-arguments.html index 592a98c..5c9fc668 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/no-arguments.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/no-arguments.html
@@ -5,7 +5,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(t => { +promise_test(t => { return promise_rejects(t, new TypeError(), requestDeviceWithKeyDown()); }, 'requestDevice() requires an argument.'); </script>
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/unicode-valid-length-name-name.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/unicode-valid-length-name-name.html index 0a2660d9..47e17da 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/unicode-valid-length-name-name.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/unicode-valid-length-name-name.html
@@ -2,8 +2,10 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> <script> -bluetooth_test(() => { +promise_test(() => { // \u2764's UTF-8 representation is 3 bytes long. // 9 chars * 3 bytes/char = 27 bytes let valid_unicode_name = '\u2764'.repeat(9);
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/unicode-valid-length-name-namePrefix.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/unicode-valid-length-name-namePrefix.html index 67be1ebb..4bab47bf 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/unicode-valid-length-name-namePrefix.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/unicode-valid-length-name-namePrefix.html
@@ -2,8 +2,10 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> <script> -bluetooth_test(() => { +promise_test(() => { // \u2764's UTF-8 representation is 3 bytes long. // 9 chars * 3 bytes/char = 27 bytes let valid_unicode_name = '\u2764'.repeat(9);
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/wrong-service-in-optionalServices-member.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/wrong-service-in-optionalServices-member.html index 2e6ab22..cc21b0a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/wrong-service-in-optionalServices-member.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/wrong-service-in-optionalServices-member.html
@@ -28,7 +28,7 @@ filters: [{ namePrefix: 'Pre'}] }]; -bluetooth_test(t => { +promise_test(t => { let test_promises = Promise.resolve(); test_specs.forEach(args => { test_promises = test_promises.then(() => promise_rejects(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/wrong-service-in-services-member.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/wrong-service-in-services-member.html index 3d8cf54..c9f96ea 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/wrong-service-in-services-member.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/canonicalizeFilter/wrong-service-in-services-member.html
@@ -3,7 +3,7 @@ <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> -bluetooth_test(t => { +promise_test(t => { let test_promises = Promise.resolve(); generateRequestDeviceArgsWithServices(['wrong_service']).forEach(args => { test_promises = test_promises.then(() => promise_rejects(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/consecutive-calls.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/consecutive-calls.html index 387aefa7..39002b0 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/consecutive-calls.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/consecutive-calls.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { function assert_expected_events(events) { assert_equals(events.length, 4); assert_equals(events[0], 'chooser-opened(file://)');
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/device-removed.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/device-removed.html index d946f17..f110f87 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/device-removed.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/device-removed.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { setBluetoothManualChooser(true); let requestDevicePromise =
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/multiple-matching-devices.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/multiple-matching-devices.html index 3e304bd..5185d02a 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/multiple-matching-devices.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/multiple-matching-devices.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { setBluetoothManualChooser(true); let requestDevicePromise = setBluetoothFakeAdapter('GlucoseHeartRateAdapter')
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-all-types.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-all-types.html index ee430d6..d8764f8 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-all-types.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-all-types.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { setBluetoothManualChooser(true); let requestDevicePromise =
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-connected-devices.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-connected-devices.html index 0de2c3a0..abb67cb5 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-connected-devices.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-connected-devices.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { setBluetoothManualChooser(true); let requestDevicePromise =
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-device-added.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-device-added.html index 91f62c0..4a454de 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-device-added.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-device-added.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { setBluetoothManualChooser(true); let requestDevicePromise =
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-device-changed.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-device-changed.html index 433d97067..88dcb75 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-device-changed.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-device-changed.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { setBluetoothManualChooser(true); let requestDevicePromise =
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-services-discovered.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-services-discovered.html index da23c00..00153cc9 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-services-discovered.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/new-scan-services-discovered.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { setBluetoothManualChooser(true); let requestDevicePromise =
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/restart-scan-finds-new-device.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/restart-scan-finds-new-device.html index 3680179..5a423c2 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/restart-scan-finds-new-device.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/restart-scan-finds-new-device.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { setBluetoothManualChooser(true); // Open the chooser, looking for a Heart Rate device.
diff --git a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/restart-scan-includes-previous-device.html b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/restart-scan-includes-previous-device.html index 95f45d5..947cc96 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/restart-scan-includes-previous-device.html +++ b/third_party/WebKit/LayoutTests/bluetooth/requestDevice/chooser/restart-scan-includes-previous-device.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { setBluetoothManualChooser(true); // Open the chooser, looking for a Heart Rate device.
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/connect/connect-disconnected-connect.html b/third_party/WebKit/LayoutTests/bluetooth/server/connect/connect-disconnected-connect.html index 44772eb..ff8565729 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/connect/connect-disconnected-connect.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/connect/connect-disconnected-connect.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; - bluetooth_test(t => { + promise_test(t => { return setBluetoothFakeAdapter('DisconnectingHeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/connect/connect-twice.html b/third_party/WebKit/LayoutTests/bluetooth/server/connect/connect-twice.html index 4b81e93..727628f 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/connect/connect-twice.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/connect/connect-twice.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; - bluetooth_test(t => { + promise_test(t => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/connect/connection-fails.html b/third_party/WebKit/LayoutTests/bluetooth/server/connect/connection-fails.html index 7b13e4b..ab6ecbc 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/connect/connection-fails.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/connect/connection-fails.html
@@ -55,7 +55,7 @@ 'NetworkError') }]; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('FailingConnectionsAdapter') .then(() => { let test_promises = Promise.resolve();
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/connect/device-goes-out-of-range.html b/third_party/WebKit/LayoutTests/bluetooth/server/connect/device-goes-out-of-range.html index bcead6f..398d58d 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/connect/device-goes-out-of-range.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/connect/device-goes-out-of-range.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/connect/garbage-collection-ran-during-error.html b/third_party/WebKit/LayoutTests/bluetooth/server/connect/garbage-collection-ran-during-error.html index bcea4d5..9aa12e3 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/connect/garbage-collection-ran-during-error.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/connect/garbage-collection-ran-during-error.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(t => { +promise_test(t => { return setBluetoothFakeAdapter('FailingConnectionsAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: [errorUUID(0x1) /* in progress error */]}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/connect/garbage-collection-ran-during-success.html b/third_party/WebKit/LayoutTests/bluetooth/server/connect/garbage-collection-ran-during-success.html index d2edfc66..7b735914 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/connect/garbage-collection-ran-during-success.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/connect/garbage-collection-ran-during-success.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return getDiscoveredHealthThermometerDevice() .then(({device, fake_peripheral}) => { return fake_peripheral.setNextGATTConnectionResponse({code: HCI_SUCCESS})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/connect/get-same-gatt-server.html b/third_party/WebKit/LayoutTests/bluetooth/server/connect/get-same-gatt-server.html index 398f6bb..62f9d0b 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/connect/get-same-gatt-server.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/connect/get-same-gatt-server.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return getDiscoveredHealthThermometerDevice() .then(({device, fake_peripheral}) => { return fake_peripheral
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/connect/same-gatt-server-both-receive-disconnect-event.html b/third_party/WebKit/LayoutTests/bluetooth/server/connect/same-gatt-server-both-receive-disconnect-event.html index e5e923f..3a4d936 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/connect/same-gatt-server-both-receive-disconnect-event.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/connect/same-gatt-server-both-receive-disconnect-event.html
@@ -5,7 +5,7 @@ <script> 'use strict'; var device; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/disconnect/connect-disconnect-twice.html b/third_party/WebKit/LayoutTests/bluetooth/server/disconnect/connect-disconnect-twice.html index 691837d..b6b7696 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/disconnect/connect-disconnect-twice.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/disconnect/connect-disconnect-twice.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/disconnect/disconnect-after-request-disconnection.html b/third_party/WebKit/LayoutTests/bluetooth/server/disconnect/disconnect-after-request-disconnection.html index 92ebe86..f35c0fed 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/disconnect/disconnect-after-request-disconnection.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/disconnect/disconnect-after-request-disconnection.html
@@ -7,7 +7,7 @@ var device; var server; var numEvents = 0; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('DisconnectingHealthThermometerAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['health_thermometer']}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/disconnect/disconnect-fires-event.html b/third_party/WebKit/LayoutTests/bluetooth/server/disconnect/disconnect-fires-event.html index bd7f79ec..53e9b01 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/disconnect/disconnect-fires-event.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/disconnect/disconnect-fires-event.html
@@ -7,7 +7,7 @@ // TODO(ortuno): Write tests to check that "Disconnect" was actually // called on the device. // http://crbug.com/569716 - bluetooth_test(() => { + promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/disconnect/disconnect-once.html b/third_party/WebKit/LayoutTests/bluetooth/server/disconnect/disconnect-once.html index 00c297a..5be345b 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/disconnect/disconnect-once.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/disconnect/disconnect-once.html
@@ -7,7 +7,7 @@ // TODO(ortuno): Write tests to check that "Disconnect" was actually // called on the device. // http://crbug.com/569716 -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/disconnect/disconnect-twice-in-a-row.html b/third_party/WebKit/LayoutTests/bluetooth/server/disconnect/disconnect-twice-in-a-row.html index 68c2ce7..1e6205b 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/disconnect/disconnect-twice-in-a-row.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/disconnect/disconnect-twice-in-a-row.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/service-found.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/service-found.html index d5ce568..a544178 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/service-found.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/service-found.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return getHealthThermometerDevice({ filters: [{services: ['health_thermometer']}], optionalServices: ['generic_access']})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/two-iframes-from-same-origin.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/two-iframes-from-same-origin.html index 500470c..c2454be 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/two-iframes-from-same-origin.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryService/two-iframes-from-same-origin.html
@@ -2,6 +2,8 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> <script> "use strict"; const test_desc = 'Two iframes in the same origin should be able to access ' + @@ -35,7 +37,7 @@ return promise; } -bluetooth_test(() => getHealthThermometerDevice() +promise_test(() => getHealthThermometerDevice() // 1. Add the first iframe. .then(() => add_iframe(iframe1)) // 2. Connect with the first iframe, requesting the health thermometer
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/blocklisted-services-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/blocklisted-services-with-uuid.html index 80c6043..15d1086 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/blocklisted-services-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/blocklisted-services-with-uuid.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return getHIDDevice({ filters: [{services: ['device_information']}], optionalServices: ['human_interface_device']})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/blocklisted-services.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/blocklisted-services.html index c9a50c17..08842d5 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/blocklisted-services.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/blocklisted-services.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return getHIDDevice({ filters: [{services: ['device_information']}], optionalServices: [
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/correct-services.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/correct-services.html index 1fc37b0..ec51588 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/correct-services.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/correct-services.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return getConnectedHealthThermometerDevice({ filters: [{services: ['health_thermometer']}] })
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/delayed-discovery-no-permission-present-service.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/delayed-discovery-no-permission-present-service.html index 4587791..0680440 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/delayed-discovery-no-permission-present-service.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/delayed-discovery-no-permission-present-service.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('DelayedServicesDiscoveryAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{name: 'Heart Rate Device'}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/delayed-discovery-service-not-found.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/delayed-discovery-service-not-found.html index 0a07b3f..1a009f0b 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/delayed-discovery-service-not-found.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/delayed-discovery-service-not-found.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('DelayedServicesDiscoveryAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{name: 'Heart Rate Device'}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/no-permission-present-service.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/no-permission-present-service.html index 3f2f606..ea37367 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/no-permission-present-service.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/no-permission-present-service.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{name: 'Heart Rate Device'}],
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/services-found-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/services-found-with-uuid.html index d00b6ea..63ac04e 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/services-found-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/services-found-with-uuid.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return getTwoHealthThermometerServicesDevice({ filters: [{services: ['health_thermometer']}]}) .then(({device}) => Promise.all([
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/services-found.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/services-found.html index 7d9648f..880108c 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/services-found.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/services-found.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -bluetooth_test(function() { +promise_test(function() { return getTwoHealthThermometerServicesDevice({ filters: [{services: ['health_thermometer']}], optionalServices: ['generic_access']})
diff --git a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/services-not-found.html b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/services-not-found.html index d436ff3..f621118 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/services-not-found.html +++ b/third_party/WebKit/LayoutTests/bluetooth/server/getPrimaryServices/services-not-found.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return getEmptyHealthThermometerDevice() .then(({device}) => assert_promise_rejects_with_message( device.gatt.getPrimaryServices(),
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/characteristic-found.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/characteristic-found.html index 62a3991..0b8a44d 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/characteristic-found.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristic/characteristic-found.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return getHealthThermometerDevice() .then(({device}) => device.gatt.getPrimaryService('health_thermometer')) .then(service => {
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/blocklisted-characteristics.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/blocklisted-characteristics.html index 4ad2781d..5ae3941 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/blocklisted-characteristics.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/blocklisted-characteristics.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return getHIDDevice({filters: [{services: ['device_information']}]}) .then(({device}) => device.gatt.getPrimaryService('device_information')) .then(service => assert_promise_rejects_with_message(
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/characteristics-found-with-uuid.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/characteristics-found-with-uuid.html index 1d4a214..788994f2 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/characteristics-found-with-uuid.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/characteristics-found-with-uuid.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return getDiscoveredHealthThermometerDevice() .then(({device, fake_peripheral}) => { // Setup a device with two measurement intervals.
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/characteristics-found.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/characteristics-found.html index 143e8f2..d5b884d 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/characteristics-found.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/characteristics-found.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return getDiscoveredHealthThermometerDevice() .then(({device, fake_peripheral}) => { // Setup a device with two measurement intervals.
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/characteristics-not-found.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/characteristics-not-found.html index 7c21ca2..e3baf08e 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/characteristics-not-found.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/characteristics-not-found.html
@@ -2,9 +2,11 @@ <script src="../../../resources/testharness.js"></script> <script src="../../../resources/testharnessreport.js"></script> <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> +<script src="../../../resources/bluetooth/web-bluetooth-test.js"></script> +<script src="../../../resources/mojo-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return getEmptyHealthThermometerService() .then(({service}) => assert_promise_rejects_with_message( service.getCharacteristics(),
diff --git a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/correct-characteristics.html b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/correct-characteristics.html index 3462764..7caf5c6 100644 --- a/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/correct-characteristics.html +++ b/third_party/WebKit/LayoutTests/bluetooth/service/getCharacteristics/correct-characteristics.html
@@ -4,7 +4,7 @@ <script src="../../../resources/bluetooth/bluetooth-helpers.js"></script> <script> 'use strict'; -bluetooth_test(() => { +promise_test(() => { return setBluetoothFakeAdapter('HeartRateAdapter') .then(() => requestDeviceWithKeyDown({ filters: [{services: ['heart_rate']}]}))
diff --git a/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js b/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js index 22c66a2..eb3d6d8f 100644 --- a/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js +++ b/third_party/WebKit/LayoutTests/resources/bluetooth/bluetooth-helpers.js
@@ -20,12 +20,8 @@ function loadChromiumResources() { let root = window.location.pathname.match(/.*LayoutTests/); let resource_prefix = `${root}/resources`; - let gen_prefix = 'file:///gen/'; return loadScripts([ - `${gen_prefix}/layout_test_data/mojo/public/js/mojo_bindings.js`, - `${gen_prefix}/content/test/data/mojo_layouttest_test.mojom.js`, - `${gen_prefix}/device/bluetooth/public/interfaces/uuid.mojom.js`, - `${gen_prefix}/device/bluetooth/public/interfaces/test/fake_bluetooth.mojom.js`, + `${resource_prefix}/mojo-helpers.js`, `${resource_prefix}/bluetooth/web-bluetooth-test.js`, ]); }
diff --git a/third_party/WebKit/LayoutTests/resources/bluetooth/web-bluetooth-test.js b/third_party/WebKit/LayoutTests/resources/bluetooth/web-bluetooth-test.js index fb54febd..d752829 100644 --- a/third_party/WebKit/LayoutTests/resources/bluetooth/web-bluetooth-test.js +++ b/third_party/WebKit/LayoutTests/resources/bluetooth/web-bluetooth-test.js
@@ -1,380 +1,426 @@ -'use strict'; +(() => { + let mojo_; -function toMojoCentralState(state) { - switch (state) { - case 'absent': - return bluetooth.mojom.CentralState.ABSENT; - case 'powered-off': - return bluetooth.mojom.CentralState.POWERED_OFF; - case 'powered-on': - return bluetooth.mojom.CentralState.POWERED_ON; - default: - throw `Unsupported value ${state} for state.`; - } -} + async function loadFakeBluetoothInterfaces() { + if(typeof mojo_ !== 'undefined') { + return mojo_; + } -// Mapping of the property names of -// BluetoothCharacteristicProperties defined in -// https://webbluetoothcg.github.io/web-bluetooth/#characteristicproperties -// to property names of the CharacteristicProperties mojo struct. -const CHARACTERISTIC_PROPERTIES_WEB_TO_MOJO = { - broadcast: 'broadcast', - read: 'read', - write_without_response: 'write_without_response', - write: 'write', - notify: 'notify', - indicate: 'indicate', - authenticatedSignedWrites: 'authenticated_signed_writes', - extended_properties: 'extended_properties', -}; + if (typeof loadMojoModules === 'undefined') { + throw 'Mojo is required for this API.' + } -function ArrayToMojoCharacteristicProperties(arr) { - let struct = new bluetooth.mojom.CharacteristicProperties(); + mojo_ = await loadMojoModules('fakeBluetooth', [ + 'mojo/public/js/bindings', + 'device/bluetooth/public/interfaces/test/fake_bluetooth.mojom' + ]); - arr.forEach(val => { - let mojo_property = - CHARACTERISTIC_PROPERTIES_WEB_TO_MOJO[val]; + [mojo_.bindings, { + CentralState: mojo_.CentralState, + FakeBluetooth: mojo_.FakeBluetooth, + FakeBluetoothPtr: mojo_.FakeBluetoothPtr, + FakeCentral: mojo_.FakeCentral, + FakeCentralPtr: mojo_.FakeCentralPtr, + CharacteristicProperties: mojo_.CharacteristicProperties, + }] = mojo_.modules; - if (struct.hasOwnProperty(mojo_property)) - struct[mojo_property] = true; - else - throw `Invalid member '${val}' for CharacteristicProperties`; - }); - - return struct; -} - - -class FakeBluetooth { - constructor() { - this.fake_bluetooth_ptr_ = new bluetooth.mojom.FakeBluetoothPtr(); - Mojo.bindInterface(bluetooth.mojom.FakeBluetooth.name, - mojo.makeRequest(this.fake_bluetooth_ptr_).handle, "process"); + return mojo_; } - // Set it to indicate whether the platform supports BLE. For example, - // Windows 7 is a platform that doesn't support Low Energy. On the other - // hand Windows 10 is a platform that does support LE, even if there is no - // Bluetooth radio present. - async setLESupported(supported) { - // Call setBluetoothFakeAdapter() to clean up any fake adapters left over - // by legacy tests. - // Legacy tests that use setBluetoothFakeAdapter() sometimes fail to clean - // their fake adapter. This is not a problem for these tests because the - // next setBluetoothFakeAdapter() will clean it up anyway but it is a - // problem for the new tests that do not use setBluetoothFakeAdapter(). - // TODO(crbug.com/569709): Remove once setBluetoothFakeAdapter is no - // longer used. - await setBluetoothFakeAdapter(''); - - if (typeof supported !== 'boolean') throw 'Type Not Supported'; - await this.fake_bluetooth_ptr_.setLESupported(supported); + function toMojoCentralState(state) { + switch (state) { + case 'absent': + return mojo_.CentralState.ABSENT; + case 'powered-off': + return mojo_.CentralState.POWERED_OFF; + case 'powered-on': + return mojo_.CentralState.POWERED_ON; + default: + throw `Unsupported value ${state} for state.`; + } } - // Returns a promise that resolves with a FakeCentral that clients can use - // to simulate events that a device in the Central/Observer role would - // receive as well as monitor the operations performed by the device in the - // Central/Observer role. - // Calls sets LE as supported. - // - // A "Central" object would allow its clients to receive advertising events - // and initiate connections to peripherals i.e. operations of two roles - // defined by the Bluetooth Spec: Observer and Central. - // See Bluetooth 4.2 Vol 3 Part C 2.2.2 "Roles when Operating over an - // LE Physical Transport". - async simulateCentral({state}) { - await this.setLESupported(true); + // Mapping of the property names of + // BluetoothCharacteristicProperties defined in + // https://webbluetoothcg.github.io/web-bluetooth/#characteristicproperties + // to property names of the CharacteristicProperties mojo struct. + const CHARACTERISTIC_PROPERTIES_WEB_TO_MOJO = { + broadcast: 'broadcast', + read: 'read', + write_without_response: 'write_without_response', + write: 'write', + notify: 'notify', + indicate: 'indicate', + authenticatedSignedWrites: 'authenticated_signed_writes', + extended_properties: 'extended_properties', + }; - let {fakeCentral: fake_central_ptr} = - await this.fake_bluetooth_ptr_.simulateCentral( - toMojoCentralState(state)); - return new FakeCentral(fake_central_ptr); - } + function ArrayToMojoCharacteristicProperties(arr) { + let struct = new mojo_.CharacteristicProperties(); - // Returns true if there are no pending responses. - async allResponsesConsumed() { - let {consumed} = await this.fake_bluetooth_ptr_.allResponsesConsumed(); - return consumed; - } -} + arr.forEach(val => { + let mojo_property = + CHARACTERISTIC_PROPERTIES_WEB_TO_MOJO[val]; -// FakeCentral allows clients to simulate events that a device in the -// Central/Observer role would receive as well as monitor the operations -// performed by the device in the Central/Observer role. -class FakeCentral { - constructor(fake_central_ptr) { - this.fake_central_ptr_ = fake_central_ptr; - this.peripherals_ = new Map(); - } - - // Simulates a peripheral with |address|, |name| and |known_service_uuids| - // that has already been connected to the system. If the peripheral existed - // already it updates its name and known UUIDs. |known_service_uuids| should - // be an array of BluetoothServiceUUIDs - // https://webbluetoothcg.github.io/web-bluetooth/#typedefdef-bluetoothserviceuuid - // - // Platforms offer methods to retrieve devices that have already been - // connected to the system or weren't connected through the UA e.g. a user - // connected a peripheral through the system's settings. This method is - // intended to simulate peripherals that those methods would return. - async simulatePreconnectedPeripheral({ - address, name, knownServiceUUIDs = []}) { - - // Canonicalize and convert to mojo UUIDs. - knownServiceUUIDs.forEach((val, i, arr) => { - knownServiceUUIDs[i] = {uuid: BluetoothUUID.getService(val)}; + if (struct.hasOwnProperty(mojo_property)) + struct[mojo_property] = true; + else + throw `Invalid member '${val}' for CharacteristicProperties`; }); - await this.fake_central_ptr_.simulatePreconnectedPeripheral( - address, name, knownServiceUUIDs); + return struct; + } - let peripheral = this.peripherals_.get(address); - if (peripheral === undefined) { - peripheral = new FakePeripheral(address, this.fake_central_ptr_); - this.peripherals_.set(address, peripheral); + class FakeBluetooth { + constructor() { + this.fake_bluetooth_ptr_ = undefined; } - return peripheral; - } -} + // Set it to indicate whether the platform supports BLE. For example, + // Windows 7 is a platform that doesn't support Low Energy. On the other + // hand Windows 10 is a platform that does support LE, even if there is no + // Bluetooth radio present. + async setLESupported(supported) { + // Call setBluetoothFakeAdapter() to clean up any fake adapters left over + // by legacy tests. + // Legacy tests that use setBluetoothFakeAdapter() sometimes fail to clean + // their fake adapter. This is not a problem for these tests because the + // next setBluetoothFakeAdapter() will clean it up anyway but it is a + // problem for the new tests that do not use setBluetoothFakeAdapter(). + // TODO(crbug.com/569709): Remove once setBluetoothFakeAdapter is no + // longer used. + await setBluetoothFakeAdapter(''); + await this.initFakeBluetoothInterfacePtr_(); -class FakePeripheral { - constructor(address, fake_central_ptr) { - this.address = address; - this.fake_central_ptr_ = fake_central_ptr; - } - - // Adds a fake GATT Service with |uuid| to be discovered when discovering - // the peripheral's GATT Attributes. Returns a FakeRemoteGATTService - // corresponding to this service. |uuid| should be a BluetoothServiceUUIDs - // https://webbluetoothcg.github.io/web-bluetooth/#typedefdef-bluetoothserviceuuid - async addFakeService({uuid}) { - let {serviceId: service_id} = await this.fake_central_ptr_.addFakeService( - this.address, {uuid: BluetoothUUID.getService(uuid)}); - - if (service_id === null) throw 'addFakeService failed'; - - return new FakeRemoteGATTService( - service_id, this.address, this.fake_central_ptr_); - } - - // Sets the next GATT Connection request response to |code|. |code| could be - // an HCI Error Code from BT 4.2 Vol 2 Part D 1.3 List Of Error Codes or a - // number outside that range returned by specific platforms e.g. Android - // returns 0x101 to signal a GATT failure - // https://developer.android.com/reference/android/bluetooth/BluetoothGatt.html#GATT_FAILURE - async setNextGATTConnectionResponse({code}) { - let {success} = - await this.fake_central_ptr_.setNextGATTConnectionResponse( - this.address, code); - - if (success !== true) throw 'setNextGATTConnectionResponse failed.'; - } - - // Sets the next GATT Discovery request response for peripheral with - // |address| to |code|. |code| could be an HCI Error Code from - // BT 4.2 Vol 2 Part D 1.3 List Of Error Codes or a number outside that - // range returned by specific platforms e.g. Android returns 0x101 to signal - // a GATT failure - // https://developer.android.com/reference/android/bluetooth/BluetoothGatt.html#GATT_FAILURE - // - // The following procedures defined at BT 4.2 Vol 3 Part G Section 4. - // "GATT Feature Requirements" are used to discover attributes of the - // GATT Server: - // - Primary Service Discovery - // - Relationship Discovery - // - Characteristic Discovery - // - Characteristic Descriptor Discovery - // This method aims to simulate the response once all of these procedures - // have completed or if there was an error during any of them. - async setNextGATTDiscoveryResponse({code}) { - let {success} = - await this.fake_central_ptr_.setNextGATTDiscoveryResponse( - this.address, code); - - if (success !== true) throw 'setNextGATTDiscoveryResponse failed.'; - } - - // Simulates a GATT disconnection from the peripheral with |address|. - async simulateGATTDisconnection() { - let {success} = - await this.fake_central_ptr_.simulateGATTDisconnection(this.address); - - if (success !== true) throw 'simulateGATTDisconnection failed.'; - } - - // Simulates an Indication from the peripheral's GATT `Service Changed` - // Characteristic from BT 4.2 Vol 3 Part G 7.1. This Indication is signaled - // when services, characteristics, or descriptors are changed, added, or - // removed. - // - // The value for `Service Changed` is a range of attribute handles that have - // changed. However, this testing specification works at an abstracted - // level and does not expose setting attribute handles when adding - // attributes. Consequently, this simulate method should include the full - // range of all the peripheral's attribute handle values. - async simulateGATTServicesChanged() { - let {success} = - await this.fake_central_ptr_.simulateGATTServicesChanged(this.address); - - if (success !== true) throw 'simulateGATTServicesChanged failed.'; - } -} - -class FakeRemoteGATTService { - constructor(service_id, peripheral_address, fake_central_ptr) { - this.service_id_ = service_id; - this.peripheral_address_ = peripheral_address; - this.fake_central_ptr_ = fake_central_ptr; - } - - // Adds a fake GATT Characteristic with |uuid| and |properties| - // to this fake service. The characteristic will be found when discovering - // the peripheral's GATT Attributes. Returns a FakeRemoteGATTCharacteristic - // corresponding to the added characteristic. - async addFakeCharacteristic({uuid, properties}) { - let {characteristicId: characteristic_id} = - await this.fake_central_ptr_.addFakeCharacteristic( - {uuid: BluetoothUUID.getCharacteristic(uuid)}, - ArrayToMojoCharacteristicProperties(properties), - this.service_id_, - this.peripheral_address_); - - if (characteristic_id === null) throw 'addFakeCharacteristic failed'; - - return new FakeRemoteGATTCharacteristic( - characteristic_id, this.service_id_, - this.peripheral_address_, this.fake_central_ptr_); - } -} - -class FakeRemoteGATTCharacteristic { - constructor(characteristic_id, service_id, peripheral_address, - fake_central_ptr) { - this.ids_ = [characteristic_id, service_id, peripheral_address]; - this.descriptors_ = []; - this.fake_central_ptr_ = fake_central_ptr; - } - - // Adds a fake GATT Descriptor with |uuid| to be discovered when - // discovering the peripheral's GATT Attributes. Returns a - // FakeRemoteGATTDescriptor corresponding to this descriptor. |uuid| should - // be a BluetoothDescriptorUUID - // https://webbluetoothcg.github.io/web-bluetooth/#typedefdef-bluetoothdescriptoruuid - async addFakeDescriptor({uuid}) { - let {descriptorId: descriptor_id} = - await this.fake_central_ptr_.addFakeDescriptor( - {uuid: BluetoothUUID.getDescriptor(uuid)}, ...this.ids_); - - if (descriptor_id === null) throw 'addFakeDescriptor failed'; - - let fake_descriptor = new FakeRemoteGATTDescriptor( - descriptor_id, ...this.ids_, this.fake_central_ptr_); - this.descriptors_.push(fake_descriptor); - - return fake_descriptor; - } - - // Sets the next read response for characteristic to |code| and |value|. - // |code| could be a GATT Error Response from - // BT 4.2 Vol 3 Part F 3.4.1.1 Error Response or a number outside that range - // returned by specific platforms e.g. Android returns 0x101 to signal a GATT - // failure. - // https://developer.android.com/reference/android/bluetooth/BluetoothGatt.html#GATT_FAILURE - async setNextReadResponse(gatt_code, value=null) { - if (gatt_code === 0 && value === null) { - throw '|value| can\'t be null if read should success.'; - } - if (gatt_code !== 0 && value !== null) { - throw '|value| must be null if read should fail.'; + if (typeof supported !== 'boolean') throw 'Type Not Supported'; + await this.fake_bluetooth_ptr_.setLESupported(supported); } - let {success} = - await this.fake_central_ptr_.setNextReadCharacteristicResponse( - gatt_code, value, ...this.ids_); + // Returns a promise that resolves with a FakeCentral that clients can use + // to simulate events that a device in the Central/Observer role would + // receive as well as monitor the operations performed by the device in the + // Central/Observer role. + // Calls sets LE as supported. + // + // A "Central" object would allow its clients to receive advertising events + // and initiate connections to peripherals i.e. operations of two roles + // defined by the Bluetooth Spec: Observer and Central. + // See Bluetooth 4.2 Vol 3 Part C 2.2.2 "Roles when Operating over an + // LE Physical Transport". + async simulateCentral({state}) { + // Call setBluetoothFakeAdapter() to clean up any fake adapters left over + // by legacy tests. + // Legacy tests that use setBluetoothFakeAdapter() sometimes fail to clean + // their fake adapter. This is not a problem for these tests because the + // next setBluetoothFakeAdapter() will clean it up anyway but it is a + // problem for the new tests that do not use setBluetoothFakeAdapter(). + // TODO(crbug.com/569709): Remove once setBluetoothFakeAdapter is no + // longer used. + await setBluetoothFakeAdapter(''); + await this.initFakeBluetoothInterfacePtr_(); - if (!success) throw 'setNextReadCharacteristicResponse failed'; - } + await this.setLESupported(true); - // Sets the next write response for this characteristic to |code|. If - // writing to a characteristic that only supports 'write_without_response' - // the set response will be ignored. - // |code| could be a GATT Error Response from - // BT 4.2 Vol 3 Part F 3.4.1.1 Error Response or a number outside that range - // returned by specific platforms e.g. Android returns 0x101 to signal a GATT - // failure. - async setNextWriteResponse(gatt_code) { - let {success} = - await this.fake_central_ptr_.setNextWriteCharacteristicResponse( - gatt_code, ...this.ids_); - - if (!success) throw 'setNextWriteResponse failed'; - } - - // Sets the next subscribe to notifications response for characteristic with - // |characteristic_id| in |service_id| and in |peripheral_address| to - // |code|. |code| could be a GATT Error Response from BT 4.2 Vol 3 Part F - // 3.4.1.1 Error Response or a number outside that range returned by - // specific platforms e.g. Android returns 0x101 to signal a GATT failure. - async setNextSubscribeToNotificationsResponse(gatt_code) { - let {success} = - await this.fake_central_ptr_.setNextSubscribeToNotificationsResponse( - gatt_code, ...this.ids_); - - if (!success) throw 'setNextSubscribeToNotificationsResponse failed'; - } - - // Gets the last successfully written value to the characteristic. - // Returns null if no value has yet been written to the characteristic. - async getLastWrittenValue() { - let {success, value} = - await this.fake_central_ptr_.getLastWrittenValue(...this.ids_); - - if (!success) throw 'getLastWrittenValue failed'; - - return value; - } - - // Removes the fake GATT Characteristic from its fake service. - async remove() { - let {success} = - await this.fake_central_ptr_.removeFakeCharacteristic(...this.ids_); - - if (!success) throw 'remove failed'; - } -} - -class FakeRemoteGATTDescriptor { - constructor(descriptor_id, - characteristic_id, - service_id, - peripheral_address, - fake_central_ptr) { - this.ids_ = [ - descriptor_id, characteristic_id, service_id, peripheral_address]; - this.fake_central_ptr_ = fake_central_ptr; - } - - // Sets the next read response for descriptor to |code| and |value|. - // |code| could be a GATT Error Response from - // BT 4.2 Vol 3 Part F 3.4.1.1 Error Response or a number outside that range - // returned by specific platforms e.g. Android returns 0x101 to signal a GATT - // failure. - // https://developer.android.com/reference/android/bluetooth/BluetoothGatt.html#GATT_FAILURE - async setNextReadResponse(gatt_code, value=null) { - if (gatt_code === 0 && value === null) { - throw '|value| cannot be null if read should succeed.'; - } - if (gatt_code !== 0 && value !== null) { - throw '|value| must be null if read should fail.'; + let {fake_central:fake_central_ptr} = + await this.fake_bluetooth_ptr_.simulateCentral( + toMojoCentralState(state)); + return new FakeCentral(fake_central_ptr); } - let {success} = - await this.fake_central_ptr_.setNextReadDescriptorResponse( - gatt_code, value, ...this.ids_); + // Returns true if there are no pending responses. + async allResponsesConsumed() { + let {consumed} = await this.fake_bluetooth_ptr_.allResponsesConsumed(); + return consumed; + } - if (!success) throw 'setNextReadDescriptorResponse failed'; + async initFakeBluetoothInterfacePtr_() { + if (typeof this.fake_bluetooth_ptr_ !== 'undefined') { + return this.fake_bluetooth_ptr_; + } + + let mojo = await loadFakeBluetoothInterfaces(); + + this.fake_bluetooth_ptr_ = new mojo.FakeBluetoothPtr( + mojo.interfaces.getInterface(mojo.FakeBluetooth.name)); + } } -} -navigator.bluetooth.test = new FakeBluetooth(); + // FakeCentral allows clients to simulate events that a device in the + // Central/Observer role would receive as well as monitor the operations + // performed by the device in the Central/Observer role. + class FakeCentral { + constructor(fake_central_ptr) { + this.fake_central_ptr_ = fake_central_ptr; + this.peripherals_ = new Map(); + } + + // Simulates a peripheral with |address|, |name| and |known_service_uuids| + // that has already been connected to the system. If the peripheral existed + // already it updates its name and known UUIDs. |known_service_uuids| should + // be an array of BluetoothServiceUUIDs + // https://webbluetoothcg.github.io/web-bluetooth/#typedefdef-bluetoothserviceuuid + // + // Platforms offer methods to retrieve devices that have already been + // connected to the system or weren't connected through the UA e.g. a user + // connected a peripheral through the system's settings. This method is + // intended to simulate peripherals that those methods would return. + async simulatePreconnectedPeripheral({ + address, name, knownServiceUUIDs = []}) { + + // Canonicalize and convert to mojo UUIDs. + knownServiceUUIDs.forEach((val, i, arr) => { + knownServiceUUIDs[i] = {uuid: BluetoothUUID.getService(val)}; + }); + + await this.fake_central_ptr_.simulatePreconnectedPeripheral( + address, name, knownServiceUUIDs); + + let peripheral = this.peripherals_.get(address); + if (peripheral === undefined) { + peripheral = new FakePeripheral(address, this.fake_central_ptr_); + this.peripherals_.set(address, peripheral); + } + + return peripheral; + } + } + + class FakePeripheral { + constructor(address, fake_central_ptr) { + this.address = address; + this.fake_central_ptr_ = fake_central_ptr; + } + + // Sets the next GATT Connection request response to |code|. |code| could be + // an HCI Error Code from BT 4.2 Vol 2 Part D 1.3 List Of Error Codes or a + // number outside that range returned by specific platforms e.g. Android + // returns 0x101 to signal a GATT failure + // https://developer.android.com/reference/android/bluetooth/BluetoothGatt.html#GATT_FAILURE + async setNextGATTConnectionResponse({code}) { + let {success} = + await this.fake_central_ptr_.setNextGATTConnectionResponse( + this.address, code); + + if (success !== true) throw 'setNextGATTConnectionResponse failed.'; + } + + // Adds a fake GATT Service with |uuid| to be discovered when discovering + // the peripheral's GATT Attributes. Returns a FakeRemoteGATTService + // corresponding to this service. |uuid| should be a BluetoothServiceUUIDs + // https://webbluetoothcg.github.io/web-bluetooth/#typedefdef-bluetoothserviceuuid + async addFakeService({uuid}) { + let {service_id} = await this.fake_central_ptr_.addFakeService( + this.address, {uuid: BluetoothUUID.getService(uuid)}); + + if (service_id === null) throw 'addFakeService failed'; + + return new FakeRemoteGATTService( + service_id, this.address, this.fake_central_ptr_); + } + + // Sets the next GATT Discovery request response for peripheral with + // |address| to |code|. |code| could be an HCI Error Code from + // BT 4.2 Vol 2 Part D 1.3 List Of Error Codes or a number outside that + // range returned by specific platforms e.g. Android returns 0x101 to signal + // a GATT failure + // https://developer.android.com/reference/android/bluetooth/BluetoothGatt.html#GATT_FAILURE + // + // The following procedures defined at BT 4.2 Vol 3 Part G Section 4. + // "GATT Feature Requirements" are used to discover attributes of the + // GATT Server: + // - Primary Service Discovery + // - Relationship Discovery + // - Characteristic Discovery + // - Characteristic Descriptor Discovery + // This method aims to simulate the response once all of these procedures + // have completed or if there was an error during any of them. + async setNextGATTDiscoveryResponse({code}) { + let {success} = + await this.fake_central_ptr_.setNextGATTDiscoveryResponse( + this.address, code); + + if (success !== true) throw 'setNextGATTDiscoveryResponse failed.'; + } + + // Simulates a GATT disconnection from the peripheral with |address|. + async simulateGATTDisconnection() { + let {success} = + await this.fake_central_ptr_.simulateGATTDisconnection(this.address); + + if (success !== true) throw 'simulateGATTDisconnection failed.'; + } + + // Simulates an Indication from the peripheral's GATT `Service Changed` + // Characteristic from BT 4.2 Vol 3 Part G 7.1. This Indication is signaled + // when services, characteristics, or descriptors are changed, added, or + // removed. + // + // The value for `Service Changed` is a range of attribute handles that have + // changed. However, this testing specification works at an abstracted + // level and does not expose setting attribute handles when adding + // attributes. Consequently, this simulate method should include the full + // range of all the peripheral's attribute handle values. + async simulateGATTServicesChanged() { + let {success} = + await this.fake_central_ptr_.simulateGATTServicesChanged(this.address); + + if (success !== true) throw 'simulateGATTServicesChanged failed.'; + } + } + + class FakeRemoteGATTService { + constructor(service_id, peripheral_address, fake_central_ptr) { + this.service_id_ = service_id; + this.peripheral_address_ = peripheral_address; + this.fake_central_ptr_ = fake_central_ptr; + } + + // Adds a fake GATT Characteristic with |uuid| and |properties| + // to this fake service. The characteristic will be found when discovering + // the peripheral's GATT Attributes. Returns a FakeRemoteGATTCharacteristic + // corresponding to the added characteristic. + async addFakeCharacteristic({uuid, properties}) { + let {characteristic_id} = await this.fake_central_ptr_.addFakeCharacteristic( + {uuid: BluetoothUUID.getCharacteristic(uuid)}, + ArrayToMojoCharacteristicProperties(properties), + this.service_id_, + this.peripheral_address_ + ); + + if (characteristic_id === null) throw 'addFakeCharacteristic failed'; + + return new FakeRemoteGATTCharacteristic( + characteristic_id, this.service_id_, + this.peripheral_address_, this.fake_central_ptr_); + } + } + + class FakeRemoteGATTCharacteristic { + constructor(characteristic_id, service_id, peripheral_address, fake_central_ptr) { + this.ids_ = [characteristic_id, service_id, peripheral_address]; + this.descriptors_ = []; + this.fake_central_ptr_ = fake_central_ptr; + } + + // Adds a fake GATT Descriptor with |uuid| to be discovered when + // discovering the peripheral's GATT Attributes. Returns a + // FakeRemoteGATTDescriptor corresponding to this descriptor. |uuid| should + // be a BluetoothDescriptorUUID + // https://webbluetoothcg.github.io/web-bluetooth/#typedefdef-bluetoothdescriptoruuid + async addFakeDescriptor({uuid}) { + let {descriptor_id} = await this.fake_central_ptr_.addFakeDescriptor( + {uuid: BluetoothUUID.getDescriptor(uuid)}, ...this.ids_); + + if (descriptor_id === null) throw 'addFakeDescriptor failed'; + + let fake_descriptor = new FakeRemoteGATTDescriptor( + descriptor_id, ...this.ids_, this.fake_central_ptr_); + this.descriptors_.push(fake_descriptor); + + return fake_descriptor; + } + + // Sets the next read response for characteristic to |code| and |value|. + // |code| could be a GATT Error Response from + // BT 4.2 Vol 3 Part F 3.4.1.1 Error Response or a number outside that range + // returned by specific platforms e.g. Android returns 0x101 to signal a GATT + // failure. + // https://developer.android.com/reference/android/bluetooth/BluetoothGatt.html#GATT_FAILURE + async setNextReadResponse(gatt_code, value=null) { + if (gatt_code === 0 && value === null) { + throw '|value| can\'t be null if read should success.'; + } + if (gatt_code !== 0 && value !== null) { + throw '|value| must be null if read should fail.'; + } + + let {success} = + await this.fake_central_ptr_.setNextReadCharacteristicResponse( + gatt_code, value, ...this.ids_); + + if (!success) throw 'setNextReadCharacteristicResponse failed'; + } + + // Sets the next write response for this characteristic to |code|. If + // writing to a characteristic that only supports 'write_without_response' + // the set response will be ignored. + // |code| could be a GATT Error Response from + // BT 4.2 Vol 3 Part F 3.4.1.1 Error Response or a number outside that range + // returned by specific platforms e.g. Android returns 0x101 to signal a GATT + // failure. + async setNextWriteResponse(gatt_code) { + let {success} = + await this.fake_central_ptr_.setNextWriteCharacteristicResponse( + gatt_code, ...this.ids_); + + if (!success) throw 'setNextWriteResponse failed'; + } + + // Sets the next subscribe to notifications response for characteristic with + // |characteristic_id| in |service_id| and in |peripheral_address| to + // |code|. |code| could be a GATT Error Response from BT 4.2 Vol 3 Part F + // 3.4.1.1 Error Response or a number outside that range returned by + // specific platforms e.g. Android returns 0x101 to signal a GATT failure. + async setNextSubscribeToNotificationsResponse(gatt_code) { + let {success} = + await this.fake_central_ptr_.setNextSubscribeToNotificationsResponse( + gatt_code, ...this.ids_); + + if (!success) throw 'setNextSubscribeToNotificationsResponse failed'; + } + + // Gets the last successfully written value to the characteristic. + // Returns null if no value has yet been written to the characteristic. + async getLastWrittenValue() { + let {success, value} = + await this.fake_central_ptr_.getLastWrittenValue(...this.ids_); + + if (!success) throw 'getLastWrittenValue failed'; + + return value; + } + + // Removes the fake GATT Characteristic from its fake service. + async remove() { + let {success} = + await this.fake_central_ptr_.removeFakeCharacteristic(...this.ids_); + + if (!success) throw 'remove failed'; + } + } + + class FakeRemoteGATTDescriptor { + constructor(descriptor_id, + characteristic_id, + service_id, + peripheral_address, + fake_central_ptr) { + this.ids_ = [ + descriptor_id, characteristic_id, service_id, peripheral_address]; + this.fake_central_ptr_ = fake_central_ptr; + } + + // Sets the next read response for descriptor to |code| and |value|. + // |code| could be a GATT Error Response from + // BT 4.2 Vol 3 Part F 3.4.1.1 Error Response or a number outside that range + // returned by specific platforms e.g. Android returns 0x101 to signal a GATT + // failure. + // https://developer.android.com/reference/android/bluetooth/BluetoothGatt.html#GATT_FAILURE + async setNextReadResponse(gatt_code, value=null) { + if (gatt_code === 0 && value === null) { + throw '|value| cannot be null if read should succeed.'; + } + if (gatt_code !== 0 && value !== null) { + throw '|value| must be null if read should fail.'; + } + + let {success} = + await this.fake_central_ptr_.setNextReadDescriptorResponse( + gatt_code, value, ...this.ids_); + + if (!success) throw 'setNextReadDescriptorResponse failed'; + } + } + + navigator.bluetooth.test = new FakeBluetooth(); +})();
diff --git a/third_party/WebKit/Source/core/html/ImageDocument.cpp b/third_party/WebKit/Source/core/html/ImageDocument.cpp index 35acdaf..8d9a956 100644 --- a/third_party/WebKit/Source/core/html/ImageDocument.cpp +++ b/third_party/WebKit/Source/core/html/ImageDocument.cpp
@@ -541,15 +541,12 @@ // Explicitly set the height of the <div> containing the <img> so that it // can display the full image without shrinking it, allowing a full-width - // reading mode for normal-width-huge-height images. Use the LayoutSize - // for height rather than viewport since that doesn't change based on the - // URL bar coming in and out - thus preventing the image from jumping - // around. i.e. The div should fill the viewport when minimally zoomed and - // the URL bar is showing, but won't fill the new space when the URL bar - // hides. - float aspect_ratio = View()->GetLayoutSize().AspectRatio(); - int div_height = std::max(image_size.Height().ToInt(), - static_cast<int>(div_width / aspect_ratio)); + // reading mode for normal-width-huge-height images. + float viewport_aspect_ratio = + GetFrame()->GetPage()->GetVisualViewport().Size().AspectRatio(); + int div_height = + std::max(image_size.Height().ToInt(), + static_cast<int>(div_width / viewport_aspect_ratio)); div_element_->SetInlineStyleProperty(CSSPropertyHeight, div_height, CSSPrimitiveValue::UnitType::kPixels); return;
diff --git a/third_party/WebKit/Source/core/html/ImageDocumentTest.cpp b/third_party/WebKit/Source/core/html/ImageDocumentTest.cpp index f070d3f..823e9bae 100644 --- a/third_party/WebKit/Source/core/html/ImageDocumentTest.cpp +++ b/third_party/WebKit/Source/core/html/ImageDocumentTest.cpp
@@ -7,13 +7,8 @@ #include "core/dom/Document.h" #include "core/dom/DocumentParser.h" #include "core/frame/Settings.h" -#include "core/frame/VisualViewport.h" -#include "core/geometry/DOMRect.h" #include "core/loader/EmptyClients.h" #include "core/testing/DummyPageHolder.h" -#include "core/testing/sim/SimDisplayItemList.h" -#include "core/testing/sim/SimRequest.h" -#include "core/testing/sim/SimTest.h" #include "testing/gtest/include/gtest/gtest.h" namespace blink { @@ -215,6 +210,10 @@ SetWindowToViewportScalingFactor(1.5f); LoadImage(); + // In case of android, this is a no-op. + if (!GetDocument().GetFrame()->GetSettings()->GetViewportEnabled()) + return; + EXPECT_TRUE(GetDocument().ShouldShrinkToFit()); GetDocument().ImageClicked(15, 27); ScrollOffset offset = GetDocument() @@ -237,71 +236,4 @@ EXPECT_EQ(22, offset.Height()); } -class ImageDocumentViewportTest : public SimTest { - public: - ImageDocumentViewportTest() {} - ~ImageDocumentViewportTest() override {} - - void SetUp() override { - SimTest::SetUp(); - WebView().GetSettings()->SetViewportEnabled(true); - WebView().GetSettings()->SetViewportMetaEnabled(true); - WebView().GetSettings()->SetShrinksViewportContentToFit(true); - WebView().GetSettings()->SetMainFrameResizesAreOrientationChanges(true); - } - - VisualViewport& GetVisualViewport() { - return WebView().GetPage()->GetVisualViewport(); - } - - ImageDocument& GetDocument() { - Document* document = - ToLocalFrame(WebView().GetPage()->MainFrame())->DomWindow()->document(); - ImageDocument* image_document = static_cast<ImageDocument*>(document); - return *image_document; - } -}; - -// Tests that hiding the URL bar doesn't cause a "jump" when viewing an image -// much wider than the viewport. -TEST_F(ImageDocumentViewportTest, HidingURLBarDoesntChangeImageLocation) { - v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); - - // Initialize with the URL bar showing. Make the viewport very thin so that - // we load an image much wider than the viewport but fits vertically. The - // page will load zoomed out so the image will be vertically centered. - WebView().ResizeWithBrowserControls(IntSize(5, 40), 10, 0, true); - SimRequest request("https://example.com/test.jpg", "image/jpeg"); - LoadURL("https://example.com/test.jpg"); - - Vector<unsigned char> jpeg = JpegImage(); - Vector<char> data = Vector<char>(); - data.Append(jpeg.data(), jpeg.size()); - request.Complete(data); - - Compositor().BeginFrame(); - - HTMLImageElement* img = GetDocument().ImageElement(); - DOMRect* rect = img->getBoundingClientRect(); - - // Some initial sanity checking. We'll use the BoundingClientRect for the - // image location since that's relative to the layout viewport and the layout - // viewport is unscrollable in this test. Since the image is 10X wider than - // the viewport, we'll zoom out to 0.1. This means the layout viewport is 400 - // pixels high so the image will be centered in that. - ASSERT_EQ(50u, img->width()); - ASSERT_EQ(50u, img->height()); - ASSERT_EQ(0.1f, GetVisualViewport().Scale()); - ASSERT_EQ(0, rect->x()); - ASSERT_EQ(175, rect->y()); - - // Hide the URL bar. This will make the viewport taller but won't change the - // layout size so the image location shouldn't change. - WebView().ResizeWithBrowserControls(IntSize(5, 50), 10, 0, false); - Compositor().BeginFrame(); - rect = img->getBoundingClientRect(); - EXPECT_EQ(0, rect->x()); - EXPECT_EQ(175, rect->y()); -} - } // namespace blink
diff --git a/third_party/WebKit/Source/core/input/EventHandler.h b/third_party/WebKit/Source/core/input/EventHandler.h index 6853c06..7e15455a 100644 --- a/third_party/WebKit/Source/core/input/EventHandler.h +++ b/third_party/WebKit/Source/core/input/EventHandler.h
@@ -414,6 +414,8 @@ FRIEND_TEST_ALL_PREFIXES(EventHandlerTest, InputFieldsCanStartSelection); FRIEND_TEST_ALL_PREFIXES(EventHandlerTest, ImagesCannotStartSelection); FRIEND_TEST_ALL_PREFIXES(EventHandlerTest, AnchorTextCannotStartSelection); + FRIEND_TEST_ALL_PREFIXES(EventHandlerTest, + ReadOnlyInputDoesNotInheritUserSelect); }; } // namespace blink
diff --git a/third_party/WebKit/Source/core/input/EventHandlerTest.cpp b/third_party/WebKit/Source/core/input/EventHandlerTest.cpp index 173463d6..d895507 100644 --- a/third_party/WebKit/Source/core/input/EventHandlerTest.cpp +++ b/third_party/WebKit/Source/core/input/EventHandlerTest.cpp
@@ -16,6 +16,7 @@ #include "core/frame/LocalFrame.h" #include "core/frame/LocalFrameView.h" #include "core/frame/Settings.h" +#include "core/html/HTMLInputElement.h" #include "core/layout/LayoutObject.h" #include "core/loader/EmptyClients.h" #include "core/page/AutoscrollController.h" @@ -435,23 +436,20 @@ TEST_F(EventHandlerTest, ReadOnlyInputDoesNotInheritUserSelect) { SetHtmlInnerHTML( "<div style='user-select: none'>" - "<input readonly value='blabla'>" + "<input id='sample' readonly value='blabla'>" "</div>"); - Element* const field = - ToElement(GetDocument().body()->firstChild()->firstChild()); - ShadowRoot* const shadow_root = field->UserAgentShadowRoot(); + HTMLInputElement* const input = + ToHTMLInputElement(GetDocument().getElementById("sample")); + Node* const text = input->InnerEditorElement()->firstChild(); - Element* const text = shadow_root->getElementById("inner-editor"); LayoutPoint location = text->GetLayoutObject()->VisualRect().Center(); HitTestResult hit = GetDocument().GetFrame()->GetEventHandler().HitTestResultAtPoint( location); EXPECT_TRUE(text->CanStartSelection()); - - // TODO(crbug.com/764661): Show I-beam because field is selectable. - // EXPECT_TRUE( - // GetDocument().GetFrame()->GetEventHandler().ShouldShowIBeamForNode(field, - // hit)); + EXPECT_TRUE( + GetDocument().GetFrame()->GetEventHandler().ShouldShowIBeamForNode(text, + hit)); } TEST_F(EventHandlerTest, ImagesCannotStartSelection) {
diff --git a/third_party/WebKit/Source/core/testing/sim/SimRequest.cpp b/third_party/WebKit/Source/core/testing/sim/SimRequest.cpp index b5a6c48..a7f62a5 100644 --- a/third_party/WebKit/Source/core/testing/sim/SimRequest.cpp +++ b/third_party/WebKit/Source/core/testing/sim/SimRequest.cpp
@@ -54,13 +54,6 @@ client_->DidReceiveData(data.Utf8().data(), data.length()); } -void SimRequest::Write(const Vector<char>& data) { - DCHECK(is_ready_); - DCHECK(!error_.reason); - total_encoded_data_length_ += data.size(); - client_->DidReceiveData(data.data(), data.size()); -} - void SimRequest::Finish() { DCHECK(is_ready_); if (error_.reason) { @@ -82,13 +75,6 @@ Finish(); } -void SimRequest::Complete(const Vector<char>& data) { - Start(); - if (!data.IsEmpty()) - Write(data); - Finish(); -} - void SimRequest::Reset() { is_ready_ = false; client_ = nullptr;
diff --git a/third_party/WebKit/Source/core/testing/sim/SimRequest.h b/third_party/WebKit/Source/core/testing/sim/SimRequest.h index 65928a7..5030b6ca 100644 --- a/third_party/WebKit/Source/core/testing/sim/SimRequest.h +++ b/third_party/WebKit/Source/core/testing/sim/SimRequest.h
@@ -5,7 +5,6 @@ #ifndef SimRequest_h #define SimRequest_h -#include "platform/wtf/Vector.h" #include "platform/wtf/text/WTFString.h" #include "public/platform/WebURLError.h" #include "public/platform/WebURLResponse.h" @@ -30,14 +29,12 @@ // Write a chunk of the response body. void Write(const String& data); - void Write(const Vector<char>& data); // Finish the response, this is as if the server closed the connection. void Finish(); // Shorthand to complete a request (start/write/finish) sequence in order. void Complete(const String& data = String()); - void Complete(const Vector<char>& data); const String& Url() const { return url_; } const WebURLError& GetError() const { return error_; }
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_metrics_helper.cc b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_metrics_helper.cc index fc30a625..7b32f8f 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_metrics_helper.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_metrics_helper.cc
@@ -64,6 +64,10 @@ } FrameOriginState GetFrameOriginState(const WebFrameScheduler& frame_scheduler) { + if (frame_scheduler.GetFrameType() == + WebFrameScheduler::FrameType::kMainFrame) { + return FrameOriginState::MAIN_FRAME; + } if (frame_scheduler.IsCrossOrigin()) return FrameOriginState::CROSS_ORIGIN; return FrameOriginState::SAME_ORIGIN;
diff --git a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_metrics_helper_unittest.cc b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_metrics_helper_unittest.cc index 9fddfbf..1f53b5a 100644 --- a/third_party/WebKit/Source/platform/scheduler/renderer/renderer_metrics_helper_unittest.cc +++ b/third_party/WebKit/Source/platform/scheduler/renderer/renderer_metrics_helper_unittest.cc
@@ -39,12 +39,16 @@ public: MockWebFrameScheduler(bool is_page_visible, bool is_frame_visible, + WebFrameScheduler::FrameType frame_type, bool is_cross_origin, bool is_exempt_from_throttling) : is_page_visible_(is_page_visible), is_frame_visible_(is_frame_visible), + frame_type_(frame_type), is_cross_origin_(is_cross_origin), - is_exempt_from_throttling_(is_exempt_from_throttling) {} + is_exempt_from_throttling_(is_exempt_from_throttling) { + DCHECK(frame_type_ != FrameType::kMainFrame || !is_cross_origin); + } bool IsCrossOrigin() const override { return is_cross_origin_; } bool IsExemptFromThrottling() const override { @@ -52,10 +56,12 @@ } bool IsFrameVisible() const override { return is_frame_visible_; } bool IsPageVisible() const override { return is_page_visible_; } + FrameType GetFrameType() const override { return frame_type_; } private: bool is_page_visible_; bool is_frame_visible_; + WebFrameScheduler::FrameType frame_type_; bool is_cross_origin_; bool is_exempt_from_throttling_; }; @@ -208,21 +214,25 @@ } TEST_F(RendererMetricsHelperTest, GetFrameTypeTest) { - // TODO(altimin): Fix when we have WebFrameScheduler::IsMainFrame. - MockWebFrameScheduler frame1(true, true, false, false); - EXPECT_EQ(GetFrameType(frame1), FrameType::SAME_ORIGIN_VISIBLE); + MockWebFrameScheduler frame1( + true, true, WebFrameScheduler::FrameType::kMainFrame, false, false); + EXPECT_EQ(GetFrameType(frame1), FrameType::MAIN_FRAME_VISIBLE); - MockWebFrameScheduler frame2(true, false, false, false); + MockWebFrameScheduler frame2( + true, false, WebFrameScheduler::FrameType::kSubframe, false, false); EXPECT_EQ(GetFrameType(frame2), FrameType::SAME_ORIGIN_HIDDEN); - MockWebFrameScheduler frame3(true, false, true, false); + MockWebFrameScheduler frame3( + true, false, WebFrameScheduler::FrameType::kSubframe, true, false); EXPECT_EQ(GetFrameType(frame3), FrameType::CROSS_ORIGIN_HIDDEN); - MockWebFrameScheduler frame4(false, false, false, false); + MockWebFrameScheduler frame4( + false, false, WebFrameScheduler::FrameType::kSubframe, false, false); EXPECT_EQ(GetFrameType(frame4), FrameType::SAME_ORIGIN_BACKGROUND); - MockWebFrameScheduler frame5(false, false, true, true); - DCHECK_EQ(GetFrameType(frame5), FrameType::CROSS_ORIGIN_BACKGROUND_EXEMPT); + MockWebFrameScheduler frame5( + false, false, WebFrameScheduler::FrameType::kMainFrame, false, true); + DCHECK_EQ(GetFrameType(frame5), FrameType::MAIN_FRAME_BACKGROUND_EXEMPT); } // TODO(crbug.com/754656): Add tests for NthMinute and AfterNthMinute
diff --git a/tools/valgrind/gtest_exclude/unit_tests.gtest_linux.txt b/tools/valgrind/gtest_exclude/unit_tests.gtest_linux.txt deleted file mode 100644 index e30315a7..0000000 --- a/tools/valgrind/gtest_exclude/unit_tests.gtest_linux.txt +++ /dev/null
@@ -1,10 +0,0 @@ -# http://crbug.com/336349 -NTPUserDataLoggerTest.TestLogging - -# http://crbug.com/403533 -ExtensionPathUtilTest.BasicPrettifyPathTest - -# http://crbug.com/523600 -ClientCertStoreChromeOSTest.Filter -ClientCertStoreChromeOSTest.RequestsAfterNSSInitSucceed -ClientCertStoreChromeOSTest.CertRequestMatching
diff --git a/ui/display/manager/chromeos/display_change_observer.cc b/ui/display/manager/chromeos/display_change_observer.cc index f83bc2b..b0122b2 100644 --- a/ui/display/manager/chromeos/display_change_observer.cc +++ b/ui/display/manager/chromeos/display_change_observer.cc
@@ -150,11 +150,9 @@ [](const DisplaySnapshot* display_state) { return display_state->display_id(); }); - - const DisplayLayout& layout = - display_manager_->layout_store()->GetRegisteredDisplayLayout(list); - return layout.mirrored ? MULTIPLE_DISPLAY_STATE_DUAL_MIRROR - : MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED; + bool mirrored = display_manager_->layout_store()->GetMirrorMode(list); + return mirrored ? MULTIPLE_DISPLAY_STATE_DUAL_MIRROR + : MULTIPLE_DISPLAY_STATE_DUAL_EXTENDED; } bool DisplayChangeObserver::GetResolutionForDisplayId(int64_t display_id,
diff --git a/ui/display/manager/display_layout_store.cc b/ui/display/manager/display_layout_store.cc index 08721f48..9ed5c673 100644 --- a/ui/display/manager/display_layout_store.cc +++ b/ui/display/manager/display_layout_store.cc
@@ -86,6 +86,12 @@ layouts_[list] = std::move(layout); } +bool DisplayLayoutStore::GetMirrorMode(const DisplayIdList& list) { + if (forced_mirror_mode_) + return true; + return GetRegisteredDisplayLayout(list).mirrored; +} + const DisplayLayout& DisplayLayoutStore::GetRegisteredDisplayLayout( const DisplayIdList& list) { DCHECK_GT(list.size(), 1u);
diff --git a/ui/display/manager/display_layout_store.h b/ui/display/manager/display_layout_store.h index d7e5167..6dcead3 100644 --- a/ui/display/manager/display_layout_store.h +++ b/ui/display/manager/display_layout_store.h
@@ -22,12 +22,18 @@ DisplayLayoutStore(); ~DisplayLayoutStore(); + // Set true to force mirror mode. + void set_forced_mirror_mode(bool forced) { forced_mirror_mode_ = forced; } + void SetDefaultDisplayPlacement(const DisplayPlacement& placement); // Registers the display layout info for the specified display(s). void RegisterLayoutForDisplayIdList(const DisplayIdList& list, std::unique_ptr<DisplayLayout> layout); + // Returns true if it should enter mirror mode for given display |list|. + bool GetMirrorMode(const DisplayIdList& list); + // If no layout is registered, it creatas new layout using // |default_display_layout_|. const DisplayLayout& GetRegisteredDisplayLayout(const DisplayIdList& list); @@ -46,6 +52,8 @@ // The default display placement. DisplayPlacement default_display_placement_; + bool forced_mirror_mode_ = false; + // Display layout per list of devices. std::map<DisplayIdList, std::unique_ptr<DisplayLayout>> layouts_;