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

Side by Side Diff: components/wallpaper/wallpaper_resizer_unittest.cc

Issue 1917673002: Convert //components/[u-z]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Build fix Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/wallpaper/wallpaper_resizer.h"
6
5 #include <stdint.h> 7 #include <stdint.h>
6 8
9 #include <memory>
10
7 #include "base/macros.h" 11 #include "base/macros.h"
8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
10 #include "base/test/sequenced_worker_pool_owner.h" 13 #include "base/test/sequenced_worker_pool_owner.h"
11 #include "components/wallpaper/wallpaper_resizer.h"
12 #include "components/wallpaper/wallpaper_resizer_observer.h" 14 #include "components/wallpaper/wallpaper_resizer_observer.h"
13 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
14 #include "ui/gfx/image/image_skia_rep.h" 16 #include "ui/gfx/image/image_skia_rep.h"
15 17
16 namespace { 18 namespace {
17 19
18 const int kTestImageWidth = 5; 20 const int kTestImageWidth = 5;
19 const int kTestImageHeight = 2; 21 const int kTestImageHeight = 2;
20 const int kTargetWidth = 1; 22 const int kTargetWidth = 1;
21 const int kTargetHeight = 1; 23 const int kTargetHeight = 1;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 60
59 class WallpaperResizerTest : public testing::Test, 61 class WallpaperResizerTest : public testing::Test,
60 public WallpaperResizerObserver { 62 public WallpaperResizerObserver {
61 public: 63 public:
62 WallpaperResizerTest() : worker_pool_owner_(1, "WallpaperResizerTest") {} 64 WallpaperResizerTest() : worker_pool_owner_(1, "WallpaperResizerTest") {}
63 ~WallpaperResizerTest() override {} 65 ~WallpaperResizerTest() override {}
64 66
65 gfx::ImageSkia Resize(const gfx::ImageSkia& image, 67 gfx::ImageSkia Resize(const gfx::ImageSkia& image,
66 const gfx::Size& target_size, 68 const gfx::Size& target_size,
67 WallpaperLayout layout) { 69 WallpaperLayout layout) {
68 scoped_ptr<WallpaperResizer> resizer; 70 std::unique_ptr<WallpaperResizer> resizer;
69 resizer.reset( 71 resizer.reset(
70 new WallpaperResizer(image, target_size, layout, worker_pool())); 72 new WallpaperResizer(image, target_size, layout, worker_pool()));
71 resizer->AddObserver(this); 73 resizer->AddObserver(this);
72 resizer->StartResize(); 74 resizer->StartResize();
73 WaitForResize(); 75 WaitForResize();
74 resizer->RemoveObserver(this); 76 resizer->RemoveObserver(this);
75 return resizer->image(); 77 return resizer->image();
76 } 78 }
77 79
78 base::SequencedWorkerPool* worker_pool() { 80 base::SequencedWorkerPool* worker_pool() {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 worker_pool()); 151 worker_pool());
150 EXPECT_EQ(WallpaperResizer::GetImageId(image), resizer.original_image_id()); 152 EXPECT_EQ(WallpaperResizer::GetImageId(image), resizer.original_image_id());
151 resizer.AddObserver(this); 153 resizer.AddObserver(this);
152 resizer.StartResize(); 154 resizer.StartResize();
153 WaitForResize(); 155 WaitForResize();
154 resizer.RemoveObserver(this); 156 resizer.RemoveObserver(this);
155 EXPECT_EQ(WallpaperResizer::GetImageId(image), resizer.original_image_id()); 157 EXPECT_EQ(WallpaperResizer::GetImageId(image), resizer.original_image_id());
156 } 158 }
157 159
158 } // namespace ash 160 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698