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

Unified Diff: chrome/browser/ui/panels/panel_view_browsertest.cc

Issue 10987037: Add tests for panel app icon functionaility. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Patch w/ reenabling task manager test removed Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/panels/panel_browsertest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/panels/panel_view_browsertest.cc
diff --git a/chrome/browser/ui/panels/panel_view_browsertest.cc b/chrome/browser/ui/panels/panel_view_browsertest.cc
index 473a3a8bfef68fc4634878d7ad3f5458a3064a5f..8d457cabaffc46a5fb5b29980027fd9f50522ee1 100644
--- a/chrome/browser/ui/panels/panel_view_browsertest.cc
+++ b/chrome/browser/ui/panels/panel_view_browsertest.cc
@@ -2,13 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/win/windows_version.h"
#include "chrome/browser/ui/panels/base_panel_browser_test.h"
#include "chrome/browser/ui/panels/panel.h"
#include "chrome/browser/ui/panels/panel_constants.h"
#include "chrome/browser/ui/panels/panel_frame_view.h"
#include "chrome/browser/ui/panels/panel_view.h"
#include "chrome/browser/ui/views/tab_icon_view.h"
+#include "chrome/browser/web_applications/web_app.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gfx/icon_util.h"
#include "ui/views/controls/button/image_button.h"
#include "ui/views/controls/button/menu_button.h"
#include "ui/views/controls/image_view.h"
@@ -134,3 +137,32 @@ IN_PROC_BROWSER_TEST_F(PanelViewTest, PanelLayout) {
EXPECT_LT(title_text->x() + title_text->width(), minimize_button->x());
EXPECT_LT(minimize_button->x() + minimize_button->width(), close_button->x());
}
+
+#if defined(OS_WIN) && !defined(USE_AURA)
Dmitry Titov 2012/09/25 23:34:21 This seems to be a "Views" test file, but here it
jianli 2012/10/01 23:58:23 Changed to platform independent test.
+IN_PROC_BROWSER_TEST_F(PanelViewTest, PanelAppIcon) {
+ // Create a test extension from the manifest with icons provided.
+ scoped_refptr<extensions::Extension> extension = LoadExtensionFromManifest(
+ FILE_PATH_LITERAL("test_extension/manifest.json"));
+ std::string extension_app_name =
+ web_app::GenerateApplicationNameFromExtensionId(extension->id());
+
+ // Create a panel with the extension as host.
+ CreatePanelParams params(extension_app_name, gfx::Rect(), SHOW_AS_INACTIVE);
+ Panel* panel = CreatePanelWithParams(params);
+
+ // Validate the app icon (for Windows 7 and later).
jennb 2012/09/25 22:50:35 You could make a NativePanelTesting API for gettin
jianli 2012/10/01 23:58:23 Done.
+ if (base::win::GetVersion() >= base::win::VERSION_WIN7) {
+ HWND native_window = GetNativeWindow(panel);
+ HICON app_icon = reinterpret_cast<HICON>(
+ ::SendMessage(native_window, WM_GETICON, ICON_BIG, 0L));
+ ASSERT_TRUE(app_icon != NULL);
+
+ scoped_ptr<SkBitmap> bitmap(IconUtil::CreateSkBitmapFromHICON(app_icon));
+ ASSERT_TRUE(bitmap.get() != NULL);
+ EXPECT_EQ(32, bitmap->width());
+ EXPECT_EQ(32, bitmap->height());
+ }
+
+ panel->Close();
+}
+#endif
« no previous file with comments | « chrome/browser/ui/panels/panel_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698