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

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

Issue 10987037: Add tests for panel app icon functionaility. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix builds 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_browsertest.cc
diff --git a/chrome/browser/ui/panels/panel_browsertest.cc b/chrome/browser/ui/panels/panel_browsertest.cc
index 1f397bebba23989f3890a976e8ef393c9dbcbe3a..abaaf17fd4ef003870a9546d8a7fcfadabeb2e31 100644
--- a/chrome/browser/ui/panels/panel_browsertest.cc
+++ b/chrome/browser/ui/panels/panel_browsertest.cc
@@ -1689,3 +1689,48 @@ IN_PROC_BROWSER_TEST_F(PanelBrowserTest, MAYBE_Accelerator) {
signal.Wait();
EXPECT_EQ(0, panel_manager->num_panels());
}
+
+IN_PROC_BROWSER_TEST_F(PanelBrowserTest, PanelAppIcon) {
jennb 2012/10/02 17:51:08 Neither of these two tests rely on BasePanelBrowse
jianli 2012/10/02 21:37:26 Done.
+ // 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);
+ WaitForAppIconAvailable(panel);
+ scoped_ptr<NativePanelTesting> native_panel_testing(
+ CreateNativePanelTesting(panel));
+
+ // First verify on the panel level.
+ gfx::ImageSkia app_icon = panel->app_icon().AsImageSkia();
+ EXPECT_EQ(32, app_icon.width());
+ EXPECT_EQ(32, app_icon.height());
+
+ // Then verify on the native panel level.
+ EXPECT_TRUE(native_panel_testing->VerifyAppIcon());
+
+ panel->Close();
+}
+
+// Tests that icon loading might not be completed when the panel is closed.
+// (crbug.com/151484)
+IN_PROC_BROWSER_TEST_F(PanelBrowserTest, ClosePanelBeforeIconLoadingCompleted) {
+ // Create a test extension from the manifest with icons provided.
+ scoped_refptr<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);
+ // Do not wait because we want to close the panel before the callback to
+ // signal the icon loading completion is executed.
+ params.wait_for_fully_created = false;
+ Panel* panel = CreatePanelWithParams(params);
+
+ panel->Close();
+}
+

Powered by Google App Engine
This is Rietveld 408576698