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

Side by Side Diff: ash/shelf/shelf_tooltip_manager_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/shelf/shelf_navigator_unittest.cc ('k') | ash/shelf/shelf_unittest.cc » ('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 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 "ash/shelf/shelf_tooltip_manager.h" 5 #include "ash/shelf/shelf_tooltip_manager.h"
6 6
7 #include "ash/shelf/shelf_layout_manager.h" 7 #include "ash/shelf/shelf_layout_manager.h"
8 #include "ash/shelf/shelf_widget.h" 8 #include "ash/shelf/shelf_widget.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_window_ids.h" 10 #include "ash/shell_window_ids.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 } 43 }
44 44
45 bool TooltipIsVisible() { return tooltip_manager_->IsVisible(); } 45 bool TooltipIsVisible() { return tooltip_manager_->IsVisible(); }
46 bool IsTimerRunning() { return tooltip_manager_->timer_.IsRunning(); } 46 bool IsTimerRunning() { return tooltip_manager_->timer_.IsRunning(); }
47 47
48 aura::Window* GetTooltipWindow() { 48 aura::Window* GetTooltipWindow() {
49 return tooltip_manager_->bubble_->GetWidget()->GetNativeWindow(); 49 return tooltip_manager_->bubble_->GetWidget()->GetNativeWindow();
50 } 50 }
51 51
52 protected: 52 protected:
53 scoped_ptr<views::Widget> widget_; 53 std::unique_ptr<views::Widget> widget_;
54 scoped_ptr<views::View> dummy_anchor_; 54 std::unique_ptr<views::View> dummy_anchor_;
55 55
56 Shelf* shelf_; 56 Shelf* shelf_;
57 ShelfTooltipManager* tooltip_manager_; 57 ShelfTooltipManager* tooltip_manager_;
58 58
59 private: 59 private:
60 void CreateWidget() { 60 void CreateWidget() {
61 dummy_anchor_.reset(new views::View); 61 dummy_anchor_.reset(new views::View);
62 widget_.reset(new views::Widget); 62 widget_.reset(new views::Widget);
63 views::Widget::InitParams params( 63 views::Widget::InitParams params(
64 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS); 64 views::Widget::InitParams::TYPE_WINDOW_FRAMELESS);
(...skipping 17 matching lines...) Expand all
82 ShowImmediately(); 82 ShowImmediately();
83 EXPECT_TRUE(TooltipIsVisible()); 83 EXPECT_TRUE(TooltipIsVisible());
84 EXPECT_FALSE(IsTimerRunning()); 84 EXPECT_FALSE(IsTimerRunning());
85 } 85 }
86 86
87 TEST_F(ShelfTooltipManagerTest, HideWhenShelfIsHidden) { 87 TEST_F(ShelfTooltipManagerTest, HideWhenShelfIsHidden) {
88 ShowImmediately(); 88 ShowImmediately();
89 ASSERT_TRUE(TooltipIsVisible()); 89 ASSERT_TRUE(TooltipIsVisible());
90 90
91 // Create a full-screen window to hide the shelf. 91 // Create a full-screen window to hide the shelf.
92 scoped_ptr<views::Widget> widget(new views::Widget); 92 std::unique_ptr<views::Widget> widget(new views::Widget);
93 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW); 93 views::Widget::InitParams params(views::Widget::InitParams::TYPE_WINDOW);
94 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 94 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
95 params.context = CurrentContext(); 95 params.context = CurrentContext();
96 widget->Init(params); 96 widget->Init(params);
97 widget->SetFullscreen(true); 97 widget->SetFullscreen(true);
98 widget->Show(); 98 widget->Show();
99 99
100 // Once the shelf is hidden, the tooltip should be invisible. 100 // Once the shelf is hidden, the tooltip should be invisible.
101 ASSERT_EQ(SHELF_HIDDEN, shelf_->shelf_layout_manager()->visibility_state()); 101 ASSERT_EQ(SHELF_HIDDEN, shelf_->shelf_layout_manager()->visibility_state());
102 EXPECT_FALSE(TooltipIsVisible()); 102 EXPECT_FALSE(TooltipIsVisible());
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 205
206 // Should not hide for key events. 206 // Should not hide for key events.
207 ShowImmediately(); 207 ShowImmediately();
208 ASSERT_TRUE(TooltipIsVisible()); 208 ASSERT_TRUE(TooltipIsVisible());
209 generator.PressKey(ui::VKEY_A, ui::EF_NONE); 209 generator.PressKey(ui::VKEY_A, ui::EF_NONE);
210 EXPECT_TRUE(TooltipIsVisible()); 210 EXPECT_TRUE(TooltipIsVisible());
211 } 211 }
212 212
213 } // namespace test 213 } // namespace test
214 } // namespace ash 214 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_navigator_unittest.cc ('k') | ash/shelf/shelf_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698