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

Side by Side Diff: chrome/browser/extensions/api/app_window/app_window_apitest.cc

Issue 494033002: Move AppWindow to extensions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove unneeded include in chrome_shell_delegate.cc Created 6 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 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 "apps/app_window.h"
6 #include "apps/app_window_registry.h"
7 #include "base/run_loop.h" 5 #include "base/run_loop.h"
8 #include "base/strings/string_number_conversions.h" 6 #include "base/strings/string_number_conversions.h"
9 #include "chrome/browser/apps/app_browsertest_util.h" 7 #include "chrome/browser/apps/app_browsertest_util.h"
10 #include "chrome/browser/extensions/extension_test_message_listener.h" 8 #include "chrome/browser/extensions/extension_test_message_listener.h"
11 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
12 #include "chrome/common/extensions/features/feature_channel.h" 10 #include "chrome/common/extensions/features/feature_channel.h"
13 #include "chrome/test/base/testing_profile.h" 11 #include "chrome/test/base/testing_profile.h"
12 #include "extensions/browser/app_window/app_window.h"
13 #include "extensions/browser/app_window/app_window_registry.h"
14 #include "extensions/browser/app_window/native_app_window.h" 14 #include "extensions/browser/app_window/native_app_window.h"
15 #include "ui/base/base_window.h" 15 #include "ui/base/base_window.h"
16 #include "ui/gfx/rect.h" 16 #include "ui/gfx/rect.h"
17 17
18 #if defined(OS_WIN) 18 #if defined(OS_WIN)
19 #include "ui/base/win/shell.h" 19 #include "ui/base/win/shell.h"
20 #endif 20 #endif
21 21
22 using apps::AppWindow; 22 namespace extensions {
23 23
24 namespace { 24 namespace {
25 25
26 class TestAppWindowRegistryObserver : public apps::AppWindowRegistry::Observer { 26 class TestAppWindowRegistryObserver : public AppWindowRegistry::Observer {
27 public: 27 public:
28 explicit TestAppWindowRegistryObserver(Profile* profile) 28 explicit TestAppWindowRegistryObserver(Profile* profile)
29 : profile_(profile), icon_updates_(0) { 29 : profile_(profile), icon_updates_(0) {
30 apps::AppWindowRegistry::Get(profile_)->AddObserver(this); 30 AppWindowRegistry::Get(profile_)->AddObserver(this);
31 } 31 }
32 virtual ~TestAppWindowRegistryObserver() { 32 virtual ~TestAppWindowRegistryObserver() {
33 apps::AppWindowRegistry::Get(profile_)->RemoveObserver(this); 33 AppWindowRegistry::Get(profile_)->RemoveObserver(this);
34 } 34 }
35 35
36 // Overridden from AppWindowRegistry::Observer: 36 // Overridden from AppWindowRegistry::Observer:
37 virtual void OnAppWindowIconChanged(AppWindow* app_window) OVERRIDE { 37 virtual void OnAppWindowIconChanged(AppWindow* app_window) OVERRIDE {
38 ++icon_updates_; 38 ++icon_updates_;
39 } 39 }
40 40
41 int icon_updates() { return icon_updates_; } 41 int icon_updates() { return icon_updates_; }
42 42
43 private: 43 private:
44 Profile* profile_; 44 Profile* profile_;
45 int icon_updates_; 45 int icon_updates_;
46 46
47 DISALLOW_COPY_AND_ASSIGN(TestAppWindowRegistryObserver); 47 DISALLOW_COPY_AND_ASSIGN(TestAppWindowRegistryObserver);
48 }; 48 };
49 49
50 } // namespace 50 } // namespace
51 51
52 namespace extensions {
53
54 // Tests chrome.app.window.setIcon. 52 // Tests chrome.app.window.setIcon.
55 IN_PROC_BROWSER_TEST_F(ExperimentalPlatformAppBrowserTest, WindowsApiSetIcon) { 53 IN_PROC_BROWSER_TEST_F(ExperimentalPlatformAppBrowserTest, WindowsApiSetIcon) {
56 scoped_ptr<TestAppWindowRegistryObserver> test_observer( 54 scoped_ptr<TestAppWindowRegistryObserver> test_observer(
57 new TestAppWindowRegistryObserver(browser()->profile())); 55 new TestAppWindowRegistryObserver(browser()->profile()));
58 ExtensionTestMessageListener listener("ready", true); 56 ExtensionTestMessageListener listener("ready", true);
59 57
60 // Launch the app and wait for it to be ready. 58 // Launch the app and wait for it to be ready.
61 LoadAndLaunchPlatformApp("windows_api_set_icon", &listener); 59 LoadAndLaunchPlatformApp("windows_api_set_icon", &listener);
62 EXPECT_EQ(0, test_observer->icon_updates()); 60 EXPECT_EQ(0, test_observer->icon_updates());
63 listener.Reply(""); 61 listener.Reply("");
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 } 154 }
157 155
158 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, 156 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest,
159 WindowsApiAlphaEnabledWrongFrameType) { 157 WindowsApiAlphaEnabledWrongFrameType) {
160 EXPECT_TRUE(RunPlatformAppTest( 158 EXPECT_TRUE(RunPlatformAppTest(
161 "platform_apps/windows_api_alpha_enabled/wrong_frame_type")) 159 "platform_apps/windows_api_alpha_enabled/wrong_frame_type"))
162 << message_; 160 << message_;
163 } 161 }
164 162
165 } // namespace extensions 163 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698