OLD | NEW |
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 "chrome/browser/ui/views/tabs/tab.h" | 5 #include "chrome/browser/ui/views/tabs/tab.h" |
6 | 6 |
7 #include "chrome/browser/ui/views/tabs/tab_controller.h" | 7 #include "chrome/browser/ui/views/tabs/tab_controller.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 #include "ui/base/models/list_selection_model.h" | 9 #include "ui/base/models/list_selection_model.h" |
10 #include "ui/views/test/views_test_base.h" | 10 #include "ui/views/test/views_test_base.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 TabTest() {} | 66 TabTest() {} |
67 virtual ~TabTest() {} | 67 virtual ~TabTest() {} |
68 | 68 |
69 static SkColor GetIconDominantColor(const Tab& tab) { | 69 static SkColor GetIconDominantColor(const Tab& tab) { |
70 return tab.icon_dominant_color_; | 70 return tab.icon_dominant_color_; |
71 } | 71 } |
72 }; | 72 }; |
73 | 73 |
74 TEST_F(TabTest, HitTestTopPixel) { | 74 TEST_F(TabTest, HitTestTopPixel) { |
75 Widget widget; | 75 Widget widget; |
76 Widget::InitParams params; | 76 Widget::InitParams params(CreateParams(Widget::InitParams::TYPE_WINDOW)); |
77 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 77 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
78 params.bounds.SetRect(10, 20, 300, 400); | 78 params.bounds.SetRect(10, 20, 300, 400); |
79 widget.Init(params); | 79 widget.Init(params); |
80 | 80 |
81 FakeTabController tab_controller; | 81 FakeTabController tab_controller; |
82 Tab tab(&tab_controller); | 82 Tab tab(&tab_controller); |
83 widget.GetContentsView()->AddChildView(&tab); | 83 widget.GetContentsView()->AddChildView(&tab); |
84 tab.SetBoundsRect(gfx::Rect(gfx::Point(0, 0), Tab::GetStandardSize())); | 84 tab.SetBoundsRect(gfx::Rect(gfx::Point(0, 0), Tab::GetStandardSize())); |
85 | 85 |
86 // Tabs have some shadow in the top, so by default we don't hit the tab there. | 86 // Tabs have some shadow in the top, so by default we don't hit the tab there. |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 green_bitmap.allocPixels(); | 140 green_bitmap.allocPixels(); |
141 green_bitmap.eraseColor(SK_ColorGREEN); | 141 green_bitmap.eraseColor(SK_ColorGREEN); |
142 TabRendererData green_data; | 142 TabRendererData green_data; |
143 green_data.favicon = gfx::ImageSkia(green_bitmap); | 143 green_data.favicon = gfx::ImageSkia(green_bitmap); |
144 tab.SetData(green_data); | 144 tab.SetData(green_data); |
145 | 145 |
146 // Icon updates automatically since we're in immersive mode and the image | 146 // Icon updates automatically since we're in immersive mode and the image |
147 // changed. | 147 // changed. |
148 EXPECT_EQ(SK_ColorGREEN, GetIconDominantColor(tab)); | 148 EXPECT_EQ(SK_ColorGREEN, GetIconDominantColor(tab)); |
149 } | 149 } |
OLD | NEW |