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

Side by Side 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, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/bind.h" 5 #include "base/bind.h"
6 #include "base/utf_string_conversions.h" 6 #include "base/utf_string_conversions.h"
7 #include "chrome/app/chrome_command_ids.h" 7 #include "chrome/app/chrome_command_ids.h"
8 #include "chrome/browser/debugger/devtools_window.h" 8 #include "chrome/browser/debugger/devtools_window.h"
9 #include "chrome/browser/net/url_request_mock_util.h" 9 #include "chrome/browser/net/url_request_mock_util.h"
10 #include "chrome/browser/prefs/browser_prefs.h" 10 #include "chrome/browser/prefs/browser_prefs.h"
(...skipping 1671 matching lines...) Expand 10 before | Expand all | Expand 10 after
1682 ::MSG key_msg = { NULL, WM_KEYDOWN, ui::VKEY_W, 0 }; 1682 ::MSG key_msg = { NULL, WM_KEYDOWN, ui::VKEY_W, 0 };
1683 content::NativeWebKeyboardEvent key_event(key_msg); 1683 content::NativeWebKeyboardEvent key_event(key_msg);
1684 key_event.modifiers = content::NativeWebKeyboardEvent::ControlKey; 1684 key_event.modifiers = content::NativeWebKeyboardEvent::ControlKey;
1685 #else 1685 #else
1686 content::NativeWebKeyboardEvent key_event; 1686 content::NativeWebKeyboardEvent key_event;
1687 #endif 1687 #endif
1688 panel->HandleKeyboardEvent(key_event); 1688 panel->HandleKeyboardEvent(key_event);
1689 signal.Wait(); 1689 signal.Wait();
1690 EXPECT_EQ(0, panel_manager->num_panels()); 1690 EXPECT_EQ(0, panel_manager->num_panels());
1691 } 1691 }
1692
1693 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.
1694 // Create a test extension from the manifest with icons provided.
1695 scoped_refptr<extensions::Extension> extension = LoadExtensionFromManifest(
1696 FILE_PATH_LITERAL("test_extension/manifest.json"));
1697 std::string extension_app_name =
1698 web_app::GenerateApplicationNameFromExtensionId(extension->id());
1699
1700 // Create a panel with the extension as host.
1701 CreatePanelParams params(extension_app_name, gfx::Rect(), SHOW_AS_INACTIVE);
1702 Panel* panel = CreatePanelWithParams(params);
1703 WaitForAppIconAvailable(panel);
1704 scoped_ptr<NativePanelTesting> native_panel_testing(
1705 CreateNativePanelTesting(panel));
1706
1707 // First verify on the panel level.
1708 gfx::ImageSkia app_icon = panel->app_icon().AsImageSkia();
1709 EXPECT_EQ(32, app_icon.width());
1710 EXPECT_EQ(32, app_icon.height());
1711
1712 // Then verify on the native panel level.
1713 EXPECT_TRUE(native_panel_testing->VerifyAppIcon());
1714
1715 panel->Close();
1716 }
1717
1718 // Tests that icon loading might not be completed when the panel is closed.
1719 // (crbug.com/151484)
1720 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, ClosePanelBeforeIconLoadingCompleted) {
1721 // Create a test extension from the manifest with icons provided.
1722 scoped_refptr<Extension> extension = LoadExtensionFromManifest(
1723 FILE_PATH_LITERAL("test_extension/manifest.json"));
1724 std::string extension_app_name =
1725 web_app::GenerateApplicationNameFromExtensionId(extension->id());
1726
1727 // Create a panel with the extension as host.
1728 CreatePanelParams params(extension_app_name, gfx::Rect(), SHOW_AS_INACTIVE);
1729 // Do not wait because we want to close the panel before the callback to
1730 // signal the icon loading completion is executed.
1731 params.wait_for_fully_created = false;
1732 Panel* panel = CreatePanelWithParams(params);
1733
1734 panel->Close();
1735 }
1736
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698