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

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 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
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)
+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
+ // 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).
+ 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

Powered by Google App Engine
This is Rietveld 408576698