OLD | NEW |
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" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 TEST_F(TrayDetailsViewTest, ScrollContentsTest) { | 319 TEST_F(TrayDetailsViewTest, ScrollContentsTest) { |
320 SystemTray* tray = GetPrimarySystemTray(); | 320 SystemTray* tray = GetPrimarySystemTray(); |
321 TestItem* test_item = new TestItem; | 321 TestItem* test_item = new TestItem; |
322 tray->AddTrayItem(base::WrapUnique(test_item)); | 322 tray->AddTrayItem(base::WrapUnique(test_item)); |
323 tray->ShowDefaultView(BUBBLE_CREATE_NEW); | 323 tray->ShowDefaultView(BUBBLE_CREATE_NEW); |
324 RunAllPendingInMessageLoop(); | 324 RunAllPendingInMessageLoop(); |
325 tray->ShowDetailedView(test_item, 0, true, BUBBLE_USE_EXISTING); | 325 tray->ShowDetailedView(test_item, 0, true, BUBBLE_USE_EXISTING); |
326 RunAllPendingInMessageLoop(); | 326 RunAllPendingInMessageLoop(); |
327 test_item->detailed_view()->CreateScrollerViews(); | 327 test_item->detailed_view()->CreateScrollerViews(); |
328 | 328 |
329 test_item->detailed_view()->scroll_content()->SetPaintToLayer(true); | 329 test_item->detailed_view()->scroll_content()->SetPaintToLayer(); |
330 views::View* view1 = new views::View(); | 330 views::View* view1 = new views::View(); |
331 test_item->detailed_view()->scroll_content()->AddChildView(view1); | 331 test_item->detailed_view()->scroll_content()->AddChildView(view1); |
332 views::View* view2 = new views::View(); | 332 views::View* view2 = new views::View(); |
333 view2->SetPaintToLayer(true); | 333 view2->SetPaintToLayer(); |
334 test_item->detailed_view()->scroll_content()->AddChildView(view2); | 334 test_item->detailed_view()->scroll_content()->AddChildView(view2); |
335 views::View* view3 = new views::View(); | 335 views::View* view3 = new views::View(); |
336 view3->SetPaintToLayer(true); | 336 view3->SetPaintToLayer(); |
337 test_item->detailed_view()->scroll_content()->AddChildView(view3); | 337 test_item->detailed_view()->scroll_content()->AddChildView(view3); |
338 | 338 |
339 // Child layers should have same order as the child views. | 339 // Child layers should have same order as the child views. |
340 const std::vector<ui::Layer*>& layers = | 340 const std::vector<ui::Layer*>& layers = |
341 test_item->detailed_view()->scroll_content()->layer()->children(); | 341 test_item->detailed_view()->scroll_content()->layer()->children(); |
342 EXPECT_EQ(2u, layers.size()); | 342 EXPECT_EQ(2u, layers.size()); |
343 EXPECT_EQ(view2->layer(), layers[0]); | 343 EXPECT_EQ(view2->layer(), layers[0]); |
344 EXPECT_EQ(view3->layer(), layers[1]); | 344 EXPECT_EQ(view3->layer(), layers[1]); |
345 | 345 |
346 // Mark |view2| as sticky and add one more child (which will reorder layers). | 346 // Mark |view2| as sticky and add one more child (which will reorder layers). |
347 view2->set_id(VIEW_ID_STICKY_HEADER); | 347 view2->set_id(VIEW_ID_STICKY_HEADER); |
348 views::View* view4 = new views::View(); | 348 views::View* view4 = new views::View(); |
349 view4->SetPaintToLayer(true); | 349 view4->SetPaintToLayer(); |
350 test_item->detailed_view()->scroll_content()->AddChildView(view4); | 350 test_item->detailed_view()->scroll_content()->AddChildView(view4); |
351 | 351 |
352 // Sticky header layer should be above the last child's layer. | 352 // Sticky header layer should be above the last child's layer. |
353 EXPECT_EQ(3u, layers.size()); | 353 EXPECT_EQ(3u, layers.size()); |
354 EXPECT_EQ(view3->layer(), layers[0]); | 354 EXPECT_EQ(view3->layer(), layers[0]); |
355 EXPECT_EQ(view4->layer(), layers[1]); | 355 EXPECT_EQ(view4->layer(), layers[1]); |
356 EXPECT_EQ(view2->layer(), layers[2]); | 356 EXPECT_EQ(view2->layer(), layers[2]); |
357 } | 357 } |
358 | 358 |
359 } // namespace test | 359 } // namespace test |
360 } // namespace ash | 360 } // namespace ash |
OLD | NEW |