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

Side by Side Diff: ash/accelerators/magnifier_key_scroller_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 unified diff | Download patch
« no previous file with comments | « ash/accelerators/magnifier_key_scroller.cc ('k') | ash/accelerators/spoken_feedback_toggler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ash/accelerators/magnifier_key_scroller.h" 5 #include "ash/accelerators/magnifier_key_scroller.h"
6 6
7 #include "ash/magnifier/magnification_controller.h" 7 #include "ash/magnifier/magnification_controller.h"
8 #include "ash/shell.h" 8 #include "ash/shell.h"
9 #include "ash/test/ash_test_base.h" 9 #include "ash/test/ash_test_base.h"
10 #include "ash/wm/window_util.h" 10 #include "ash/wm/window_util.h"
(...skipping 12 matching lines...) Expand all
23 // ui::EventHandler overrides: 23 // ui::EventHandler overrides:
24 void OnKeyEvent(ui::KeyEvent* event) override { 24 void OnKeyEvent(ui::KeyEvent* event) override {
25 key_event.reset(new ui::KeyEvent( 25 key_event.reset(new ui::KeyEvent(
26 event->type(), event->key_code(), event->flags())); 26 event->type(), event->key_code(), event->flags()));
27 } 27 }
28 28
29 const ui::KeyEvent* event() const { return key_event.get(); } 29 const ui::KeyEvent* event() const { return key_event.get(); }
30 void reset() { key_event.reset(); } 30 void reset() { key_event.reset(); }
31 31
32 private: 32 private:
33 scoped_ptr<ui::KeyEvent> key_event; 33 std::unique_ptr<ui::KeyEvent> key_event;
34 34
35 DISALLOW_COPY_AND_ASSIGN(KeyEventDelegate); 35 DISALLOW_COPY_AND_ASSIGN(KeyEventDelegate);
36 }; 36 };
37 37
38 } // namespace 38 } // namespace
39 39
40 typedef ash::test::AshTestBase MagnifierKeyScrollerTest; 40 typedef ash::test::AshTestBase MagnifierKeyScrollerTest;
41 41
42 TEST_F(MagnifierKeyScrollerTest, Basic) { 42 TEST_F(MagnifierKeyScrollerTest, Basic) {
43 KeyEventDelegate delegate; 43 KeyEventDelegate delegate;
44 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate( 44 std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate(
45 &delegate, 45 &delegate, 0, gfx::Rect(10, 10, 100, 100)));
46 0,
47 gfx::Rect(10, 10, 100, 100)));
48 wm::ActivateWindow(window.get()); 46 wm::ActivateWindow(window.get());
49 47
50 MagnifierKeyScroller::ScopedEnablerForTest scoped; 48 MagnifierKeyScroller::ScopedEnablerForTest scoped;
51 Shell* shell = Shell::GetInstance(); 49 Shell* shell = Shell::GetInstance();
52 MagnificationController* controller = shell->magnification_controller(); 50 MagnificationController* controller = shell->magnification_controller();
53 controller->SetEnabled(true); 51 controller->SetEnabled(true);
54 52
55 EXPECT_EQ("200,150", controller->GetWindowPosition().ToString()); 53 EXPECT_EQ("200,150", controller->GetWindowPosition().ToString());
56 ui::test::EventGenerator& generator = GetEventGenerator(); 54 ui::test::EventGenerator& generator = GetEventGenerator();
57 55
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 EXPECT_EQ(ui::ET_KEY_PRESSED, delegate.event()->type()); 101 EXPECT_EQ(ui::ET_KEY_PRESSED, delegate.event()->type());
104 delegate.reset(); 102 delegate.reset();
105 103
106 generator.ReleaseKey(ui::VKEY_DOWN, 0); 104 generator.ReleaseKey(ui::VKEY_DOWN, 0);
107 ASSERT_TRUE(delegate.event()); 105 ASSERT_TRUE(delegate.event());
108 EXPECT_EQ(ui::ET_KEY_RELEASED, delegate.event()->type()); 106 EXPECT_EQ(ui::ET_KEY_RELEASED, delegate.event()->type());
109 delegate.reset(); 107 delegate.reset();
110 } 108 }
111 109
112 } // namespace ash 110 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/magnifier_key_scroller.cc ('k') | ash/accelerators/spoken_feedback_toggler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698