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

Unified Diff: ash/common/system/tray/tray_details_view_unittest.cc

Issue 2557333003: [ash-md] Stacks child layers properly for sticky header rows (Closed)
Patch Set: [ash-md] Stacks child layers properly for sticky header rows (no shill changes) Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ash/common/system/tray/tray_details_view.cc ('k') | ash/common/system/tray/tray_popup_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/system/tray/tray_details_view_unittest.cc
diff --git a/ash/common/system/tray/tray_details_view_unittest.cc b/ash/common/system/tray/tray_details_view_unittest.cc
index de992610ba578976b4db881271d47a327a229498..27ef8ee5dd5ae13a91133a2dceefa55f56c5fc3c 100644
--- a/ash/common/system/tray/tray_details_view_unittest.cc
+++ b/ash/common/system/tray/tray_details_view_unittest.cc
@@ -4,6 +4,7 @@
#include "ash/common/system/tray/tray_details_view.h"
+#include "ash/common/ash_view_ids.h"
#include "ash/common/material_design/material_design_controller.h"
#include "ash/common/system/tray/hover_highlight_view.h"
#include "ash/common/system/tray/special_popup_row.h"
@@ -60,6 +61,8 @@ class TestDetailsView : public TrayDetailsView {
title_row()->AddViewToRowNonMd(tray_popup_header_button_, true);
}
+ void CreateScrollerViews() { CreateScrollableList(); }
+
private:
TrayPopupHeaderButton* tray_popup_header_button_;
@@ -312,5 +315,45 @@ TEST_F(TrayDetailsViewTest, TrayPopupHeaderButtonMouseHoverFeedback) {
EXPECT_TRUE(button->background());
}
+TEST_F(TrayDetailsViewTest, ScrollContentsTest) {
+ SystemTray* tray = GetPrimarySystemTray();
+ TestItem* test_item = new TestItem;
+ tray->AddTrayItem(test_item);
+ tray->ShowDefaultView(BUBBLE_CREATE_NEW);
+ RunAllPendingInMessageLoop();
+ tray->ShowDetailedView(test_item, 0, true, BUBBLE_USE_EXISTING);
+ RunAllPendingInMessageLoop();
+ test_item->detailed_view()->CreateScrollerViews();
+
+ test_item->detailed_view()->scroll_content()->SetPaintToLayer(true);
+ views::View* view1 = new views::View();
+ test_item->detailed_view()->scroll_content()->AddChildView(view1);
+ views::View* view2 = new views::View();
+ view2->SetPaintToLayer(true);
+ test_item->detailed_view()->scroll_content()->AddChildView(view2);
+ views::View* view3 = new views::View();
+ view3->SetPaintToLayer(true);
+ test_item->detailed_view()->scroll_content()->AddChildView(view3);
+
+ // Child layers should have same order as the child views.
+ const std::vector<ui::Layer*>& layers =
+ test_item->detailed_view()->scroll_content()->layer()->children();
+ EXPECT_EQ(2u, layers.size());
+ EXPECT_EQ(view2->layer(), layers[0]);
+ EXPECT_EQ(view3->layer(), layers[1]);
+
+ // Mark |view2| as sticky and add one more child (which will reorder layers).
+ view2->set_id(VIEW_ID_STICKY_HEADER);
+ views::View* view4 = new views::View();
+ view4->SetPaintToLayer(true);
+ test_item->detailed_view()->scroll_content()->AddChildView(view4);
+
+ // Sticky header layer should be above the last child's layer.
+ EXPECT_EQ(3u, layers.size());
+ EXPECT_EQ(view3->layer(), layers[0]);
+ EXPECT_EQ(view4->layer(), layers[1]);
+ EXPECT_EQ(view2->layer(), layers[2]);
+}
+
} // namespace test
} // namespace ash
« no previous file with comments | « ash/common/system/tray/tray_details_view.cc ('k') | ash/common/system/tray/tray_popup_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698