Chromium Code Reviews| Index: chrome/browser/extensions/api/app_window/app_window_apitest.cc |
| diff --git a/chrome/browser/extensions/api/app_window/app_window_apitest.cc b/chrome/browser/extensions/api/app_window/app_window_apitest.cc |
| index 5307888e5a18ad7ee38169d85a1205315a5e293c..342fcabba35d3284171c26f2be45142c4b22a4bf 100644 |
| --- a/chrome/browser/extensions/api/app_window/app_window_apitest.cc |
| +++ b/chrome/browser/extensions/api/app_window/app_window_apitest.cc |
| @@ -5,10 +5,46 @@ |
| #include "base/string_number_conversions.h" |
| #include "chrome/browser/extensions/extension_test_message_listener.h" |
| #include "chrome/browser/extensions/platform_app_browsertest_util.h" |
| +#include "chrome/browser/extensions/shell_window_registry.h" |
| #include "chrome/browser/ui/base_window.h" |
| +#include "chrome/browser/ui/browser.h" |
| #include "chrome/browser/ui/extensions/shell_window.h" |
| +#include "chrome/test/base/testing_profile.h" |
| #include "ui/gfx/rect.h" |
| +namespace { |
| + |
| +class TestShellWindowRegistryObserver |
| + : public extensions::ShellWindowRegistry::Observer { |
| + public: |
| + explicit TestShellWindowRegistryObserver(Profile* profile) |
| + : profile_(profile), |
| + updates_(0) { |
| + extensions::ShellWindowRegistry::Get(profile_)->AddObserver(this); |
| + } |
| + virtual ~TestShellWindowRegistryObserver() { |
| + extensions::ShellWindowRegistry::Get(profile_)->RemoveObserver(this); |
| + } |
| + |
| + // Overridden from ShellWindowRegistry::Observer: |
| + virtual void OnShellWindowAdded(ShellWindow* shell_window) {} |
| + virtual void OnShellWindowUpdated(ShellWindow* shell_window) { |
| + ++updates_; |
| + } |
| + virtual void OnShellWindowRemoved(ShellWindow* shell_window) { |
| + } |
| + |
| + int updates() { return updates_; } |
| + |
| + private: |
| + Profile* profile_; |
| + int updates_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(TestShellWindowRegistryObserver); |
| +}; |
| + |
| +} // namespace |
| + |
| namespace extensions { |
| IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, WindowsApiBounds) { |
| @@ -37,6 +73,20 @@ IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, WindowsApiBounds) { |
| ASSERT_TRUE(success_listener.WaitUntilSatisfied()); |
| } |
| +// Tests chrome.app.window.setLauncherIcon. |
| +IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, WindowsApiSetLauncherIcon) { |
| + scoped_ptr<TestShellWindowRegistryObserver> test_observer( |
| + new TestShellWindowRegistryObserver(browser()->profile())); |
| + ExtensionTestMessageListener listener("IconSet", false); |
| + LoadAndLaunchPlatformApp("windows_api_set_launcher_icon"); |
| + ASSERT_TRUE(listener.WaitUntilSatisfied()); |
| + |
| + ShellWindow* shell_window = GetFirstShellWindow(); |
| + ASSERT_TRUE(shell_window); |
| + EXPECT_FALSE(shell_window->launcher_icon_url().is_empty()); |
|
jeremya
2012/12/03 00:09:34
Perhaps we could have a slightly bolder assertion
stevenjb
2012/12/03 19:02:41
That introduces a dependency on the .js in the tes
|
| + EXPECT_EQ(1, test_observer->updates()); |
| +} |
| + |
| // TODO(asargent) - Fix onMinimzed event on OSX (crbug.com/162793) and figure |
| // out what to do about the fact that minimize events don't work under ubuntu |
| // unity (crbug.com/162794 and https://bugs.launchpad.net/unity/+bug/998073). |