Chromium Code Reviews| 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 "base/win/windows_version.h" | |
| 5 #include "chrome/browser/ui/panels/base_panel_browser_test.h" | 6 #include "chrome/browser/ui/panels/base_panel_browser_test.h" |
| 6 #include "chrome/browser/ui/panels/panel.h" | 7 #include "chrome/browser/ui/panels/panel.h" |
| 7 #include "chrome/browser/ui/panels/panel_constants.h" | 8 #include "chrome/browser/ui/panels/panel_constants.h" |
| 8 #include "chrome/browser/ui/panels/panel_frame_view.h" | 9 #include "chrome/browser/ui/panels/panel_frame_view.h" |
| 9 #include "chrome/browser/ui/panels/panel_view.h" | 10 #include "chrome/browser/ui/panels/panel_view.h" |
| 10 #include "chrome/browser/ui/views/tab_icon_view.h" | 11 #include "chrome/browser/ui/views/tab_icon_view.h" |
| 12 #include "chrome/browser/web_applications/web_app.h" | |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "ui/gfx/icon_util.h" | |
| 12 #include "ui/views/controls/button/image_button.h" | 15 #include "ui/views/controls/button/image_button.h" |
| 13 #include "ui/views/controls/button/menu_button.h" | 16 #include "ui/views/controls/button/menu_button.h" |
| 14 #include "ui/views/controls/image_view.h" | 17 #include "ui/views/controls/image_view.h" |
| 15 #include "ui/views/controls/label.h" | 18 #include "ui/views/controls/label.h" |
| 16 #include "ui/views/controls/link.h" | 19 #include "ui/views/controls/link.h" |
| 17 #include "ui/views/controls/textfield/textfield.h" | 20 #include "ui/views/controls/textfield/textfield.h" |
| 18 | 21 |
| 19 // BasePanelBrowserTest now creates refactored Panels. Refactor | 22 // BasePanelBrowserTest now creates refactored Panels. Refactor |
| 20 // has only been done for Mac panels so far. | 23 // has only been done for Mac panels so far. |
| 21 class PanelViewTest : public BasePanelBrowserTest { | 24 class PanelViewTest : public BasePanelBrowserTest { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 EXPECT_GT(minimize_button->width(), 0); | 130 EXPECT_GT(minimize_button->width(), 0); |
| 128 EXPECT_GT(minimize_button->height(), 0); | 131 EXPECT_GT(minimize_button->height(), 0); |
| 129 EXPECT_LT(minimize_button->height(), titlebar_height); | 132 EXPECT_LT(minimize_button->height(), titlebar_height); |
| 130 EXPECT_GT(close_button->width(), 0); | 133 EXPECT_GT(close_button->width(), 0); |
| 131 EXPECT_GT(close_button->height(), 0); | 134 EXPECT_GT(close_button->height(), 0); |
| 132 EXPECT_LT(close_button->height(), titlebar_height); | 135 EXPECT_LT(close_button->height(), titlebar_height); |
| 133 EXPECT_LT(title_icon->x() + title_icon->width(), title_text->x()); | 136 EXPECT_LT(title_icon->x() + title_icon->width(), title_text->x()); |
| 134 EXPECT_LT(title_text->x() + title_text->width(), minimize_button->x()); | 137 EXPECT_LT(title_text->x() + title_text->width(), minimize_button->x()); |
| 135 EXPECT_LT(minimize_button->x() + minimize_button->width(), close_button->x()); | 138 EXPECT_LT(minimize_button->x() + minimize_button->width(), close_button->x()); |
| 136 } | 139 } |
| 140 | |
| 141 #if defined(OS_WIN) && !defined(USE_AURA) | |
| 142 IN_PROC_BROWSER_TEST_F(PanelViewTest, PanelAppIcon) { | |
|
jennb
2012/09/25 22:43:09
If I'm reading this right, this test verifies that
jianli
2012/09/25 22:50:04
Yes, it is sufficient to verify that we have the r
| |
| 143 // Create a test extension from the manifest with icons provided. | |
| 144 scoped_refptr<extensions::Extension> extension = LoadExtensionFromManifest( | |
| 145 FILE_PATH_LITERAL("test_extension/manifest.json")); | |
| 146 std::string extension_app_name = | |
| 147 web_app::GenerateApplicationNameFromExtensionId(extension->id()); | |
| 148 | |
| 149 // Create a panel with the extension as host. | |
| 150 CreatePanelParams params(extension_app_name, gfx::Rect(), SHOW_AS_INACTIVE); | |
| 151 Panel* panel = CreatePanelWithParams(params); | |
| 152 | |
| 153 // Validate the app icon (for Windows 7 and later). | |
| 154 if (base::win::GetVersion() >= base::win::VERSION_WIN7) { | |
| 155 HWND native_window = GetNativeWindow(panel); | |
| 156 HICON app_icon = reinterpret_cast<HICON>( | |
| 157 ::SendMessage(native_window, WM_GETICON, ICON_BIG, 0L)); | |
| 158 ASSERT_TRUE(app_icon != NULL); | |
| 159 | |
| 160 scoped_ptr<SkBitmap> bitmap(IconUtil::CreateSkBitmapFromHICON(app_icon)); | |
| 161 ASSERT_TRUE(bitmap.get() != NULL); | |
| 162 EXPECT_EQ(32, bitmap->width()); | |
| 163 EXPECT_EQ(32, bitmap->height()); | |
| 164 } | |
| 165 | |
| 166 panel->Close(); | |
| 167 } | |
| 168 #endif | |
| OLD | NEW |