Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(806)

Unified Diff: ui/compositor/layer_animator_unittest.cc

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/compositor/layer_animator.cc ('k') | ui/compositor/layer_owner.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/layer_animator_unittest.cc
diff --git a/ui/compositor/layer_animator_unittest.cc b/ui/compositor/layer_animator_unittest.cc
index b4afb64cd2575d993f35bb5ce9249d7ae62f9b1b..89bb496699318ac9bcb5391409cde3c851eefd8a 100644
--- a/ui/compositor/layer_animator_unittest.cc
+++ b/ui/compositor/layer_animator_unittest.cc
@@ -4,9 +4,10 @@
#include "ui/compositor/layer_animator.h"
+#include <memory>
+
#include "base/compiler_specific.h"
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
#include "base/strings/stringprintf.h"
#include "base/time/time.h"
#include "cc/animation/animation_events.h"
@@ -579,10 +580,9 @@ TEST(LayerAnimatorTest, ScheduleBlockedAnimation) {
LayerAnimationElement::CreateGrayscaleElement(target_grayscale,
delta)));
- scoped_ptr<LayerAnimationSequence> bounds_and_grayscale(
- new LayerAnimationSequence(
- LayerAnimationElement::CreateGrayscaleElement(start_grayscale,
- delta)));
+ std::unique_ptr<LayerAnimationSequence> bounds_and_grayscale(
+ new LayerAnimationSequence(LayerAnimationElement::CreateGrayscaleElement(
+ start_grayscale, delta)));
bounds_and_grayscale->AddElement(
LayerAnimationElement::CreateBoundsElement(target_bounds, delta));
@@ -1387,10 +1387,9 @@ TEST(LayerAnimatorTest, CyclicSequences) {
delegate.SetBrightnessFromAnimation(start_brightness);
- scoped_ptr<LayerAnimationSequence> sequence(
- new LayerAnimationSequence(
- LayerAnimationElement::CreateBrightnessElement(target_brightness,
- delta)));
+ std::unique_ptr<LayerAnimationSequence> sequence(
+ new LayerAnimationSequence(LayerAnimationElement::CreateBrightnessElement(
+ target_brightness, delta)));
sequence->AddElement(
LayerAnimationElement::CreateBrightnessElement(start_brightness, delta));
@@ -1447,9 +1446,8 @@ TEST(LayerAnimatorTest, ThreadedCyclicSequences) {
delegate.SetOpacityFromAnimation(start_opacity);
- scoped_ptr<LayerAnimationSequence> sequence(
- new LayerAnimationSequence(
- LayerAnimationElement::CreateOpacityElement(target_opacity, delta)));
+ std::unique_ptr<LayerAnimationSequence> sequence(new LayerAnimationSequence(
+ LayerAnimationElement::CreateOpacityElement(target_opacity, delta)));
sequence->AddElement(
LayerAnimationElement::CreateOpacityElement(start_opacity, delta));
@@ -1738,7 +1736,7 @@ TEST(LayerAnimatorTest, RemoveObserverShouldRemoveFromSequences) {
TEST(LayerAnimatorTest, ObserverReleasedBeforeAnimationSequenceEnds) {
TestLayerAnimationDelegate delegate;
- scoped_ptr<TestLayerAnimationObserver> observer(
+ std::unique_ptr<TestLayerAnimationObserver> observer(
new TestLayerAnimationObserver);
scoped_refptr<LayerAnimator> animator(
CreateDefaultTestAnimator(&delegate, observer.get()));
@@ -1853,7 +1851,7 @@ TEST(LayerAnimatorTest, ObserverDeletesAnimationsOnEnd) {
base::TimeDelta halfway_delta = base::TimeDelta::FromSeconds(2);
base::TimeDelta bounds_delta = base::TimeDelta::FromSeconds(3);
- scoped_ptr<DeletingLayerAnimationObserver> observer(
+ std::unique_ptr<DeletingLayerAnimationObserver> observer(
new DeletingLayerAnimationObserver(animator.get()));
animator->AddObserver(observer.get());
@@ -1960,7 +1958,7 @@ TEST(LayerAnimatorTest, ObserverDeletesAnimationsOnAbort) {
delegate.SetBrightnessFromAnimation(start_brightness);
delegate.SetBoundsFromAnimation(start_bounds);
- scoped_ptr<DeletingLayerAnimationObserver> observer(
+ std::unique_ptr<DeletingLayerAnimationObserver> observer(
new DeletingLayerAnimationObserver(animator.get()));
animator->AddObserver(observer.get());
@@ -2001,9 +1999,8 @@ TEST(LayerAnimatorTest, SettingPropertyDuringAnAnimation) {
delegate.SetOpacityFromAnimation(start_opacity);
- scoped_ptr<LayerAnimationSequence> sequence(
- new LayerAnimationSequence(
- LayerAnimationElement::CreateOpacityElement(target_opacity, delta)));
+ std::unique_ptr<LayerAnimationSequence> sequence(new LayerAnimationSequence(
+ LayerAnimationElement::CreateOpacityElement(target_opacity, delta)));
animator->StartAnimation(sequence.release());
@@ -2036,7 +2033,7 @@ TEST(LayerAnimatorTest, ImmediatelySettingNewTargetDoesNotLeak) {
int num_live_instances = 0;
base::TimeDelta delta = base::TimeDelta::FromSeconds(1);
- scoped_ptr<TestLayerAnimationSequence> sequence(
+ std::unique_ptr<TestLayerAnimationSequence> sequence(
new TestLayerAnimationSequence(
LayerAnimationElement::CreateBoundsElement(target_bounds, delta),
&num_live_instances));
@@ -2226,13 +2223,13 @@ public:
}
private:
- scoped_ptr<AnimatorOwner> animator_owner_;
- bool delete_on_animation_ended_;
- bool delete_on_animation_aborted_;
- bool delete_on_animation_scheduled_;
- bool* was_deleted_;
+ std::unique_ptr<AnimatorOwner> animator_owner_;
+ bool delete_on_animation_ended_;
+ bool delete_on_animation_aborted_;
+ bool delete_on_animation_scheduled_;
+ bool* was_deleted_;
- DISALLOW_COPY_AND_ASSIGN(DeletingObserver);
+ DISALLOW_COPY_AND_ASSIGN(DeletingObserver);
};
TEST(LayerAnimatorTest, ObserverDeletesAnimatorAfterFinishingAnimation) {
@@ -2479,7 +2476,7 @@ TEST(LayerAnimatorTest, AnimatorStartedCorrectly) {
}
TEST(LayerAnimatorTest, AnimatorRemovedFromCollectionWhenLayerIsDestroyed) {
- scoped_ptr<Layer> layer(new Layer(LAYER_TEXTURED));
+ std::unique_ptr<Layer> layer(new Layer(LAYER_TEXTURED));
LayerAnimatorTestController test_controller(layer->GetAnimator());
scoped_refptr<LayerAnimator> animator = test_controller.animator();
CollectionLayerAnimationDelegate collection_delegate;
@@ -2504,9 +2501,9 @@ TEST(LayerAnimatorTest, LayerMovedBetweenCompositorsDuringAnimation) {
ui::ContextFactory* context_factory =
InitializeContextFactoryForTests(enable_pixel_output);
const gfx::Rect bounds(10, 10, 100, 100);
- scoped_ptr<TestCompositorHost> host_1(
+ std::unique_ptr<TestCompositorHost> host_1(
TestCompositorHost::Create(bounds, context_factory));
- scoped_ptr<TestCompositorHost> host_2(
+ std::unique_ptr<TestCompositorHost> host_2(
TestCompositorHost::Create(bounds, context_factory));
host_1->Show();
host_2->Show();
@@ -2552,7 +2549,7 @@ TEST(LayerAnimatorTest, ThreadedAnimationSurvivesIfLayerRemovedAdded) {
ui::ContextFactory* context_factory =
InitializeContextFactoryForTests(enable_pixel_output);
const gfx::Rect bounds(10, 10, 100, 100);
- scoped_ptr<TestCompositorHost> host(
+ std::unique_ptr<TestCompositorHost> host(
TestCompositorHost::Create(bounds, context_factory));
host->Show();
@@ -2608,7 +2605,7 @@ class LayerOwnerAnimationObserver : public LayerAnimationObserver {
void OnLayerAnimationScheduled(LayerAnimationSequence* sequence) override {}
private:
- scoped_ptr<Layer> animator_layer_;
+ std::unique_ptr<Layer> animator_layer_;
DISALLOW_COPY_AND_ASSIGN(LayerOwnerAnimationObserver);
};
« no previous file with comments | « ui/compositor/layer_animator.cc ('k') | ui/compositor/layer_owner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698