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

Unified Diff: ash/metrics/desktop_task_switch_metric_recorder_unittest.cc

Issue 1867223004: Convert //ash from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments 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 | « ash/magnifier/magnification_controller.cc ('k') | ash/metrics/task_switch_metrics_recorder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/metrics/desktop_task_switch_metric_recorder_unittest.cc
diff --git a/ash/metrics/desktop_task_switch_metric_recorder_unittest.cc b/ash/metrics/desktop_task_switch_metric_recorder_unittest.cc
index f4c28c4ce34d9783549093feb3d3655607a5d76e..9fb597dda47b962c34877ab07190a32f7212b963 100644
--- a/ash/metrics/desktop_task_switch_metric_recorder_unittest.cc
+++ b/ash/metrics/desktop_task_switch_metric_recorder_unittest.cc
@@ -4,9 +4,10 @@
#include "ash/metrics/desktop_task_switch_metric_recorder.h"
+#include <memory>
+
#include "ash/shell.h"
#include "ash/test/ash_test_base.h"
-#include "base/memory/scoped_ptr.h"
#include "base/test/user_action_tester.h"
#include "ui/aura/test/test_window_delegate.h"
#include "ui/aura/window.h"
@@ -45,11 +46,11 @@ class DesktopTaskSwitchMetricRecorderTest : public test::AshTestBase {
// Creates a positionable window such that wm::IsWindowUserPositionable(...)
// would retun true.
- scoped_ptr<aura::Window> CreatePositionableWindow() const;
+ std::unique_ptr<aura::Window> CreatePositionableWindow() const;
// Creates a non-positionable window such that
// wm::IsWindowUserPositionable(...) would retun false.
- scoped_ptr<aura::Window> CreateNonPositionableWindow() const;
+ std::unique_ptr<aura::Window> CreateNonPositionableWindow() const;
// Wrapper to notify the test target's OnWindowActivated(...) method that
// |window| was activated due to an INPUT_EVENT.
@@ -57,10 +58,10 @@ class DesktopTaskSwitchMetricRecorderTest : public test::AshTestBase {
protected:
// Records UMA user action counts.
- scoped_ptr<base::UserActionTester> user_action_tester_;
+ std::unique_ptr<base::UserActionTester> user_action_tester_;
// The test target.
- scoped_ptr<DesktopTaskSwitchMetricRecorder> metrics_recorder_;
+ std::unique_ptr<DesktopTaskSwitchMetricRecorder> metrics_recorder_;
private:
DISALLOW_COPY_AND_ASSIGN(DesktopTaskSwitchMetricRecorderTest);
@@ -98,18 +99,18 @@ int DesktopTaskSwitchMetricRecorderTest::GetActionCount() const {
return user_action_tester_->GetActionCount(kDesktopTaskSwitchUserAction);
}
-scoped_ptr<aura::Window>
+std::unique_ptr<aura::Window>
DesktopTaskSwitchMetricRecorderTest::CreatePositionableWindow() const {
- scoped_ptr<aura::Window> window(new aura::Window(
+ std::unique_ptr<aura::Window> window(new aura::Window(
aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate()));
window->SetType(ui::wm::WINDOW_TYPE_NORMAL);
window->Init(ui::LAYER_NOT_DRAWN);
return window;
}
-scoped_ptr<aura::Window>
+std::unique_ptr<aura::Window>
DesktopTaskSwitchMetricRecorderTest::CreateNonPositionableWindow() const {
- scoped_ptr<aura::Window> window(new aura::Window(
+ std::unique_ptr<aura::Window> window(new aura::Window(
aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate()));
window->SetType(ui::wm::WINDOW_TYPE_UNKNOWN);
window->Init(ui::LAYER_NOT_DRAWN);
@@ -120,8 +121,9 @@ DesktopTaskSwitchMetricRecorderTest::CreateNonPositionableWindow() const {
// that a null window was activated last.
TEST_F(DesktopTaskSwitchMetricRecorderTest,
ActivatePositionableWindowWhenNullWindowWasActivatedLast) {
- scoped_ptr<aura::Window> null_window;
- scoped_ptr<aura::Window> positionable_window = CreatePositionableWindow();
+ std::unique_ptr<aura::Window> null_window;
+ std::unique_ptr<aura::Window> positionable_window =
+ CreatePositionableWindow();
ActiveTaskWindowWithUserInput(null_window.get());
ResetActionCounts();
@@ -135,8 +137,10 @@ TEST_F(DesktopTaskSwitchMetricRecorderTest,
TEST_F(
DesktopTaskSwitchMetricRecorderTest,
ActivatePositionableWindowWhenADifferentPositionableWindowWasActivatedLast) {
- scoped_ptr<aura::Window> positionable_window_1 = CreatePositionableWindow();
- scoped_ptr<aura::Window> positionable_window_2 = CreatePositionableWindow();
+ std::unique_ptr<aura::Window> positionable_window_1 =
+ CreatePositionableWindow();
+ std::unique_ptr<aura::Window> positionable_window_2 =
+ CreatePositionableWindow();
ActiveTaskWindowWithUserInput(positionable_window_1.get());
ResetActionCounts();
@@ -150,7 +154,8 @@ TEST_F(
TEST_F(
DesktopTaskSwitchMetricRecorderTest,
ActivatePositionableWindowWhenTheSamePositionableWindowWasActivatedLast) {
- scoped_ptr<aura::Window> positionable_window = CreatePositionableWindow();
+ std::unique_ptr<aura::Window> positionable_window =
+ CreatePositionableWindow();
ActiveTaskWindowWithUserInput(positionable_window.get());
ResetActionCounts();
@@ -163,9 +168,10 @@ TEST_F(
// a non-positionable window was activated last.
TEST_F(DesktopTaskSwitchMetricRecorderTest,
ActivatePositionableWindowWhenANonPositionableWindowWasActivatedLast) {
- scoped_ptr<aura::Window> non_positionable_window =
+ std::unique_ptr<aura::Window> non_positionable_window =
CreateNonPositionableWindow();
- scoped_ptr<aura::Window> positionable_window = CreatePositionableWindow();
+ std::unique_ptr<aura::Window> positionable_window =
+ CreatePositionableWindow();
ActiveTaskWindowWithUserInput(non_positionable_window.get());
ResetActionCounts();
@@ -178,8 +184,9 @@ TEST_F(DesktopTaskSwitchMetricRecorderTest,
// activated between two activations of the same positionable window.
TEST_F(DesktopTaskSwitchMetricRecorderTest,
ActivateNonPositionableWindowBetweenTwoPositionableWindowActivations) {
- scoped_ptr<aura::Window> positionable_window = CreatePositionableWindow();
- scoped_ptr<aura::Window> non_positionable_window =
+ std::unique_ptr<aura::Window> positionable_window =
+ CreatePositionableWindow();
+ std::unique_ptr<aura::Window> non_positionable_window =
CreateNonPositionableWindow();
ActiveTaskWindowWithUserInput(positionable_window.get());
@@ -194,8 +201,9 @@ TEST_F(DesktopTaskSwitchMetricRecorderTest,
// Verify user action is not recorded when a null window is activated.
TEST_F(DesktopTaskSwitchMetricRecorderTest, ActivateNullWindow) {
- scoped_ptr<aura::Window> positionable_window = CreatePositionableWindow();
- scoped_ptr<aura::Window> null_window = nullptr;
+ std::unique_ptr<aura::Window> positionable_window =
+ CreatePositionableWindow();
+ std::unique_ptr<aura::Window> null_window = nullptr;
ActiveTaskWindowWithUserInput(positionable_window.get());
ResetActionCounts();
@@ -207,8 +215,9 @@ TEST_F(DesktopTaskSwitchMetricRecorderTest, ActivateNullWindow) {
// Verify user action is not recorded when a non-positionable window is
// activated.
TEST_F(DesktopTaskSwitchMetricRecorderTest, ActivateNonPositionableWindow) {
- scoped_ptr<aura::Window> positionable_window = CreatePositionableWindow();
- scoped_ptr<aura::Window> non_positionable_window =
+ std::unique_ptr<aura::Window> positionable_window =
+ CreatePositionableWindow();
+ std::unique_ptr<aura::Window> non_positionable_window =
CreateNonPositionableWindow();
ActiveTaskWindowWithUserInput(positionable_window.get());
@@ -222,8 +231,10 @@ TEST_F(DesktopTaskSwitchMetricRecorderTest, ActivateNonPositionableWindow) {
// INPUT_EVENT.
TEST_F(DesktopTaskSwitchMetricRecorderTest,
ActivatePositionableWindowWithNonInputEventReason) {
- scoped_ptr<aura::Window> positionable_window_1 = CreatePositionableWindow();
- scoped_ptr<aura::Window> positionable_window_2 = CreatePositionableWindow();
+ std::unique_ptr<aura::Window> positionable_window_1 =
+ CreatePositionableWindow();
+ std::unique_ptr<aura::Window> positionable_window_2 =
+ CreatePositionableWindow();
ActiveTaskWindowWithUserInput(positionable_window_1.get());
ResetActionCounts();
@@ -257,7 +268,7 @@ class DesktopTaskSwitchMetricRecorderWithShellIntegrationTest
protected:
// Records UMA user action counts.
- scoped_ptr<base::UserActionTester> user_action_tester_;
+ std::unique_ptr<base::UserActionTester> user_action_tester_;
// Delegate used when creating new windows using the
// CreatePositionableWindowInShellWithBounds(...) method.
« no previous file with comments | « ash/magnifier/magnification_controller.cc ('k') | ash/metrics/task_switch_metrics_recorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698