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

Side by Side Diff: ash/system/tray/system_tray_unittest.cc

Issue 2934963002: [wip/exp] cc: Measure the amount of overdraw.
Patch Set: . Created 3 years, 6 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 | « no previous file | ash/test/ash_test_helper.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 (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/system/tray/system_tray.h" 5 #include "ash/system/tray/system_tray.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/accelerators/accelerator_controller.h" 10 #include "ash/accelerators/accelerator_controller.h"
11 #include "ash/accessibility_delegate.h" 11 #include "ash/accessibility_delegate.h"
12 #include "ash/public/cpp/shell_window_ids.h" 12 #include "ash/public/cpp/shell_window_ids.h"
13 #include "ash/root_window_controller.h" 13 #include "ash/root_window_controller.h"
14 #include "ash/shelf/shelf.h" 14 #include "ash/shelf/shelf.h"
15 #include "ash/shell.h" 15 #include "ash/shell.h"
16 #include "ash/system/status_area_widget.h" 16 #include "ash/system/status_area_widget.h"
17 #include "ash/system/tray/system_tray_bubble.h" 17 #include "ash/system/tray/system_tray_bubble.h"
18 #include "ash/system/tray/system_tray_item.h" 18 #include "ash/system/tray/system_tray_item.h"
19 #include "ash/system/tray/tray_constants.h" 19 #include "ash/system/tray/tray_constants.h"
20 #include "ash/system/web_notification/web_notification_tray.h" 20 #include "ash/system/web_notification/web_notification_tray.h"
21 #include "ash/test/ash_test_base.h" 21 #include "ash/test/ash_test_base.h"
22 #include "ash/test/status_area_widget_test_helper.h" 22 #include "ash/test/status_area_widget_test_helper.h"
23 #include "ash/test/test_system_tray_item.h" 23 #include "ash/test/test_system_tray_item.h"
24 #include "ash/wm/window_util.h" 24 #include "ash/wm/window_util.h"
25 #include "base/memory/ptr_util.h" 25 #include "base/memory/ptr_util.h"
26 #include "base/run_loop.h" 26 #include "base/run_loop.h"
27 #include "base/test/histogram_tester.h" 27 #include "base/test/histogram_tester.h"
28 #include "ui/base/ui_base_types.h" 28 #include "ui/base/ui_base_types.h"
29 #include "ui/compositor/scoped_animation_duration_scale_mode.h" 29 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
30 #include "ui/compositor/test/draw_waiter_for_test.h"
30 #include "ui/events/test/event_generator.h" 31 #include "ui/events/test/event_generator.h"
31 #include "ui/gfx/geometry/point.h" 32 #include "ui/gfx/geometry/point.h"
32 #include "ui/gfx/geometry/rect.h" 33 #include "ui/gfx/geometry/rect.h"
33 #include "ui/views/controls/separator.h" 34 #include "ui/views/controls/separator.h"
34 #include "ui/views/view.h" 35 #include "ui/views/view.h"
35 #include "ui/views/widget/widget.h" 36 #include "ui/views/widget/widget.h"
36 #include "ui/views/widget/widget_delegate.h" 37 #include "ui/views/widget/widget_delegate.h"
37 38
38 namespace ash { 39 namespace ash {
39 namespace test { 40 namespace test {
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 tray->ShowDefaultView(BUBBLE_CREATE_NEW); 300 tray->ShowDefaultView(BUBBLE_CREATE_NEW);
300 ASSERT_TRUE(tray->is_active()); 301 ASSERT_TRUE(tray->is_active());
301 302
302 // Changing the alignment should close the system bubble and change the 303 // Changing the alignment should close the system bubble and change the
303 // background color. 304 // background color.
304 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); 305 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT);
305 ASSERT_FALSE(tray->is_active()); 306 ASSERT_FALSE(tray->is_active());
306 RunAllPendingInMessageLoop(); 307 RunAllPendingInMessageLoop();
307 // The bubble should already be closed by now. 308 // The bubble should already be closed by now.
308 ASSERT_FALSE(tray->CloseSystemBubble()); 309 ASSERT_FALSE(tray->CloseSystemBubble());
310
311 ui::DrawWaiterForTest::WaitForCommit(tray->GetWidget()->GetCompositor());
309 } 312 }
310 313
311 TEST_F(SystemTrayTest, SystemTrayTestItems) { 314 TEST_F(SystemTrayTest, SystemTrayTestItems) {
312 SystemTray* tray = GetPrimarySystemTray(); 315 SystemTray* tray = GetPrimarySystemTray();
313 ASSERT_TRUE(tray->GetWidget()); 316 ASSERT_TRUE(tray->GetWidget());
314 317
315 TestSystemTrayItem* test_item = new TestSystemTrayItem(); 318 TestSystemTrayItem* test_item = new TestSystemTrayItem();
316 TestSystemTrayItem* detailed_item = new TestSystemTrayItem(); 319 TestSystemTrayItem* detailed_item = new TestSystemTrayItem();
317 tray->AddTrayItem(base::WrapUnique(test_item)); 320 tray->AddTrayItem(base::WrapUnique(test_item));
318 tray->AddTrayItem(base::WrapUnique(detailed_item)); 321 tray->AddTrayItem(base::WrapUnique(detailed_item));
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
586 589
587 EXPECT_EQ(0, notification_tray->tray_bubble_height_for_test()); 590 EXPECT_EQ(0, notification_tray->tray_bubble_height_for_test());
588 } 591 }
589 592
590 TEST_F(SystemTrayTest, SeparatorThickness) { 593 TEST_F(SystemTrayTest, SeparatorThickness) {
591 EXPECT_EQ(kSeparatorWidth, views::Separator::kThickness); 594 EXPECT_EQ(kSeparatorWidth, views::Separator::kThickness);
592 } 595 }
593 596
594 } // namespace test 597 } // namespace test
595 } // namespace ash 598 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/test/ash_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698