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

Side by Side Diff: ash/launcher/launcher_view_unittest.cc

Issue 23449033: [ash] Remove Launcher::GetLauncherViewForTest() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/launcher/launcher_view.h" 5 #include "ash/launcher/launcher_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
11 #include "ash/launcher/launcher.h" 11 #include "ash/launcher/launcher.h"
12 #include "ash/launcher/launcher_button.h" 12 #include "ash/launcher/launcher_button.h"
13 #include "ash/launcher/launcher_icon_observer.h" 13 #include "ash/launcher/launcher_icon_observer.h"
14 #include "ash/launcher/launcher_model.h" 14 #include "ash/launcher/launcher_model.h"
15 #include "ash/launcher/launcher_tooltip_manager.h" 15 #include "ash/launcher/launcher_tooltip_manager.h"
16 #include "ash/launcher/launcher_types.h" 16 #include "ash/launcher/launcher_types.h"
17 #include "ash/root_window_controller.h" 17 #include "ash/root_window_controller.h"
18 #include "ash/shelf/shelf_layout_manager.h" 18 #include "ash/shelf/shelf_layout_manager.h"
19 #include "ash/shelf/shelf_widget.h" 19 #include "ash/shelf/shelf_widget.h"
20 #include "ash/shell.h" 20 #include "ash/shell.h"
21 #include "ash/shell_window_ids.h" 21 #include "ash/shell_window_ids.h"
22 #include "ash/test/ash_test_base.h" 22 #include "ash/test/ash_test_base.h"
23 #include "ash/test/launcher_test_api.h"
23 #include "ash/test/launcher_view_test_api.h" 24 #include "ash/test/launcher_view_test_api.h"
24 #include "ash/test/shell_test_api.h" 25 #include "ash/test/shell_test_api.h"
25 #include "ash/test/test_launcher_delegate.h" 26 #include "ash/test/test_launcher_delegate.h"
26 #include "base/basictypes.h" 27 #include "base/basictypes.h"
27 #include "base/command_line.h" 28 #include "base/command_line.h"
28 #include "base/compiler_specific.h" 29 #include "base/compiler_specific.h"
29 #include "base/memory/scoped_ptr.h" 30 #include "base/memory/scoped_ptr.h"
30 #include "grit/ash_resources.h" 31 #include "grit/ash_resources.h"
31 #include "ui/aura/root_window.h" 32 #include "ui/aura/root_window.h"
32 #include "ui/aura/test/aura_test_base.h" 33 #include "ui/aura/test/aura_test_base.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 public: 80 public:
80 LauncherViewIconObserverTest() {} 81 LauncherViewIconObserverTest() {}
81 virtual ~LauncherViewIconObserverTest() {} 82 virtual ~LauncherViewIconObserverTest() {}
82 83
83 virtual void SetUp() OVERRIDE { 84 virtual void SetUp() OVERRIDE {
84 AshTestBase::SetUp(); 85 AshTestBase::SetUp();
85 Launcher* launcher = Launcher::ForPrimaryDisplay(); 86 Launcher* launcher = Launcher::ForPrimaryDisplay();
86 observer_.reset(new TestLauncherIconObserver(launcher)); 87 observer_.reset(new TestLauncherIconObserver(launcher));
87 88
88 launcher_view_test_.reset(new LauncherViewTestAPI( 89 launcher_view_test_.reset(new LauncherViewTestAPI(
89 launcher->GetLauncherViewForTest())); 90 LauncherTestAPI(launcher).launcher_view()));
90 launcher_view_test_->SetAnimationDuration(1); 91 launcher_view_test_->SetAnimationDuration(1);
91 } 92 }
92 93
93 virtual void TearDown() OVERRIDE { 94 virtual void TearDown() OVERRIDE {
94 observer_.reset(); 95 observer_.reset();
95 AshTestBase::TearDown(); 96 AshTestBase::TearDown();
96 } 97 }
97 98
98 TestLauncherIconObserver* observer() { return observer_.get(); } 99 TestLauncherIconObserver* observer() { return observer_.get(); }
99 100
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 class LauncherViewTest : public AshTestBase { 197 class LauncherViewTest : public AshTestBase {
197 public: 198 public:
198 LauncherViewTest() : model_(NULL), launcher_view_(NULL), browser_index_(1) {} 199 LauncherViewTest() : model_(NULL), launcher_view_(NULL), browser_index_(1) {}
199 virtual ~LauncherViewTest() {} 200 virtual ~LauncherViewTest() {}
200 201
201 virtual void SetUp() OVERRIDE { 202 virtual void SetUp() OVERRIDE {
202 AshTestBase::SetUp(); 203 AshTestBase::SetUp();
203 test::ShellTestApi test_api(Shell::GetInstance()); 204 test::ShellTestApi test_api(Shell::GetInstance());
204 model_ = test_api.launcher_model(); 205 model_ = test_api.launcher_model();
205 Launcher* launcher = Launcher::ForPrimaryDisplay(); 206 Launcher* launcher = Launcher::ForPrimaryDisplay();
206 launcher_view_ = launcher->GetLauncherViewForTest(); 207 launcher_view_ = test::LauncherTestAPI(launcher).launcher_view();
207 208
208 // The bounds should be big enough for 4 buttons + overflow chevron. 209 // The bounds should be big enough for 4 buttons + overflow chevron.
209 launcher_view_->SetBounds(0, 0, 500, 50); 210 launcher_view_->SetBounds(0, 0, 500, 50);
210 211
211 test_api_.reset(new LauncherViewTestAPI(launcher_view_)); 212 test_api_.reset(new LauncherViewTestAPI(launcher_view_));
212 test_api_->SetAnimationDuration(1); // Speeds up animation for test. 213 test_api_->SetAnimationDuration(1); // Speeds up animation for test.
213 214
214 // Add browser shortcut launcher item at index 0 for test. 215 // Add browser shortcut launcher item at index 0 for test.
215 AddBrowserShortcut(); 216 AddBrowserShortcut();
216 } 217 }
(...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 test_api_->GetButtonCount()); 1242 test_api_->GetButtonCount());
1242 gfx::Rect ideal_bounds_0 = test_api_->GetIdealBoundsByIndex(0); 1243 gfx::Rect ideal_bounds_0 = test_api_->GetIdealBoundsByIndex(0);
1243 gfx::Rect ideal_bounds_1 = test_api_->GetIdealBoundsByIndex(1); 1244 gfx::Rect ideal_bounds_1 = test_api_->GetIdealBoundsByIndex(1);
1244 EXPECT_GT(ideal_bounds_0.width(), ideal_bounds_1.width()); 1245 EXPECT_GT(ideal_bounds_0.width(), ideal_bounds_1.width());
1245 } 1246 }
1246 1247
1247 INSTANTIATE_TEST_CASE_P(LtrRtl, LauncherViewTextDirectionTest, testing::Bool()); 1248 INSTANTIATE_TEST_CASE_P(LtrRtl, LauncherViewTextDirectionTest, testing::Bool());
1248 1249
1249 } // namespace test 1250 } // namespace test
1250 } // namespace ash 1251 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698