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

Side by Side Diff: ash/common/system/tray/tray_details_view_unittest.cc

Issue 2639203007: Update SetPaintToLayer to accept LayerType (Closed)
Patch Set: Refactor Created 3 years, 11 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 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/common/system/tray/tray_details_view.h" 5 #include "ash/common/system/tray/tray_details_view.h"
6 6
7 #include "ash/common/ash_view_ids.h" 7 #include "ash/common/ash_view_ids.h"
8 #include "ash/common/material_design/material_design_controller.h" 8 #include "ash/common/material_design/material_design_controller.h"
9 #include "ash/common/system/tray/hover_highlight_view.h" 9 #include "ash/common/system/tray/hover_highlight_view.h"
10 #include "ash/common/system/tray/special_popup_row.h" 10 #include "ash/common/system/tray/special_popup_row.h"
11 #include "ash/common/system/tray/system_tray.h" 11 #include "ash/common/system/tray/system_tray.h"
12 #include "ash/common/system/tray/system_tray_item.h" 12 #include "ash/common/system/tray/system_tray_item.h"
13 #include "ash/common/system/tray/tray_constants.h" 13 #include "ash/common/system/tray/tray_constants.h"
14 #include "ash/common/system/tray/tray_popup_header_button.h" 14 #include "ash/common/system/tray/tray_popup_header_button.h"
15 #include "ash/common/system/tray/view_click_listener.h" 15 #include "ash/common/system/tray/view_click_listener.h"
16 #include "ash/test/ash_test_base.h" 16 #include "ash/test/ash_test_base.h"
17 #include "base/memory/ptr_util.h" 17 #include "base/memory/ptr_util.h"
18 #include "base/run_loop.h" 18 #include "base/run_loop.h"
19 #include "base/test/scoped_mock_time_message_loop_task_runner.h" 19 #include "base/test/scoped_mock_time_message_loop_task_runner.h"
20 #include "base/test/test_mock_time_task_runner.h" 20 #include "base/test/test_mock_time_task_runner.h"
21 #include "grit/ash_resources.h" 21 #include "grit/ash_resources.h"
22 #include "grit/ash_strings.h" 22 #include "grit/ash_strings.h"
23 #include "ui/compositor/layer_type.h"
23 #include "ui/events/test/event_generator.h" 24 #include "ui/events/test/event_generator.h"
24 #include "ui/views/controls/button/button.h" 25 #include "ui/views/controls/button/button.h"
25 #include "ui/views/view.h" 26 #include "ui/views/view.h"
26 #include "ui/views/widget/widget.h" 27 #include "ui/views/widget/widget.h"
27 28
28 namespace ash { 29 namespace ash {
29 namespace test { 30 namespace test {
30 31
31 namespace { 32 namespace {
32 33
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 TEST_F(TrayDetailsViewTest, ScrollContentsTest) { 320 TEST_F(TrayDetailsViewTest, ScrollContentsTest) {
320 SystemTray* tray = GetPrimarySystemTray(); 321 SystemTray* tray = GetPrimarySystemTray();
321 TestItem* test_item = new TestItem; 322 TestItem* test_item = new TestItem;
322 tray->AddTrayItem(base::WrapUnique(test_item)); 323 tray->AddTrayItem(base::WrapUnique(test_item));
323 tray->ShowDefaultView(BUBBLE_CREATE_NEW); 324 tray->ShowDefaultView(BUBBLE_CREATE_NEW);
324 RunAllPendingInMessageLoop(); 325 RunAllPendingInMessageLoop();
325 tray->ShowDetailedView(test_item, 0, true, BUBBLE_USE_EXISTING); 326 tray->ShowDetailedView(test_item, 0, true, BUBBLE_USE_EXISTING);
326 RunAllPendingInMessageLoop(); 327 RunAllPendingInMessageLoop();
327 test_item->detailed_view()->CreateScrollerViews(); 328 test_item->detailed_view()->CreateScrollerViews();
328 329
329 test_item->detailed_view()->scroll_content()->SetPaintToLayer(true); 330 test_item->detailed_view()->scroll_content()->SetPaintToLayer(
331 ui::LAYER_TEXTURED);
330 views::View* view1 = new views::View(); 332 views::View* view1 = new views::View();
331 test_item->detailed_view()->scroll_content()->AddChildView(view1); 333 test_item->detailed_view()->scroll_content()->AddChildView(view1);
332 views::View* view2 = new views::View(); 334 views::View* view2 = new views::View();
333 view2->SetPaintToLayer(true); 335 view2->SetPaintToLayer(ui::LAYER_TEXTURED);
334 test_item->detailed_view()->scroll_content()->AddChildView(view2); 336 test_item->detailed_view()->scroll_content()->AddChildView(view2);
335 views::View* view3 = new views::View(); 337 views::View* view3 = new views::View();
336 view3->SetPaintToLayer(true); 338 view3->SetPaintToLayer(ui::LAYER_TEXTURED);
337 test_item->detailed_view()->scroll_content()->AddChildView(view3); 339 test_item->detailed_view()->scroll_content()->AddChildView(view3);
338 340
339 // Child layers should have same order as the child views. 341 // Child layers should have same order as the child views.
340 const std::vector<ui::Layer*>& layers = 342 const std::vector<ui::Layer*>& layers =
341 test_item->detailed_view()->scroll_content()->layer()->children(); 343 test_item->detailed_view()->scroll_content()->layer()->children();
342 EXPECT_EQ(2u, layers.size()); 344 EXPECT_EQ(2u, layers.size());
343 EXPECT_EQ(view2->layer(), layers[0]); 345 EXPECT_EQ(view2->layer(), layers[0]);
344 EXPECT_EQ(view3->layer(), layers[1]); 346 EXPECT_EQ(view3->layer(), layers[1]);
345 347
346 // Mark |view2| as sticky and add one more child (which will reorder layers). 348 // Mark |view2| as sticky and add one more child (which will reorder layers).
347 view2->set_id(VIEW_ID_STICKY_HEADER); 349 view2->set_id(VIEW_ID_STICKY_HEADER);
348 views::View* view4 = new views::View(); 350 views::View* view4 = new views::View();
349 view4->SetPaintToLayer(true); 351 view4->SetPaintToLayer(ui::LAYER_TEXTURED);
350 test_item->detailed_view()->scroll_content()->AddChildView(view4); 352 test_item->detailed_view()->scroll_content()->AddChildView(view4);
351 353
352 // Sticky header layer should be above the last child's layer. 354 // Sticky header layer should be above the last child's layer.
353 EXPECT_EQ(3u, layers.size()); 355 EXPECT_EQ(3u, layers.size());
354 EXPECT_EQ(view3->layer(), layers[0]); 356 EXPECT_EQ(view3->layer(), layers[0]);
355 EXPECT_EQ(view4->layer(), layers[1]); 357 EXPECT_EQ(view4->layer(), layers[1]);
356 EXPECT_EQ(view2->layer(), layers[2]); 358 EXPECT_EQ(view2->layer(), layers[2]);
357 } 359 }
358 360
359 } // namespace test 361 } // namespace test
360 } // namespace ash 362 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698