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

Side by Side Diff: chrome/browser/chromeos/extensions/wallpaper_private_api_unittest.cc

Issue 2017113002: [Extensions] DCHECK that ExtensionFunctions respond (and only once) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
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 "chrome/browser/chromeos/extensions/wallpaper_private_api.h" 5 #include "chrome/browser/chromeos/extensions/wallpaper_private_api.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/test/ash_test_base.h" 10 #include "ash/test/ash_test_base.h"
11 #include "ash/test/test_session_state_delegate.h" 11 #include "ash/test/test_session_state_delegate.h"
12 #include "ash/test/test_shell_delegate.h" 12 #include "ash/test/test_shell_delegate.h"
13 #include "ash/wm/common/window_state.h" 13 #include "ash/wm/common/window_state.h"
14 #include "ash/wm/window_state_aura.h" 14 #include "ash/wm/window_state_aura.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" 17 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
18 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 18 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
19 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" 19 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
20 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h" 20 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager.h"
21 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h" 21 #include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_chromeos.h"
22 #include "components/signin/core/account_id/account_id.h" 22 #include "components/signin/core/account_id/account_id.h"
23 #include "extensions/browser/api_test_utils.h"
23 #include "ui/aura/test/test_windows.h" 24 #include "ui/aura/test/test_windows.h"
24 #include "ui/aura/window.h" 25 #include "ui/aura/window.h"
25 #include "ui/aura/window_event_dispatcher.h" 26 #include "ui/aura/window_event_dispatcher.h"
26 27
27 namespace chromeos { 28 namespace chromeos {
28 namespace { 29 namespace {
29 30
30 const char kTestAccount1[] = "user1@test.com"; 31 const char kTestAccount1[] = "user1@test.com";
31 const char kTestAccount2[] = "user2@test.com"; 32 const char kTestAccount2[] = "user2@test.com";
32 33
33 class WallpaperPrivateApiUnittest : public ash::test::AshTestBase { 34 class WallpaperPrivateApiUnittest : public ash::test::AshTestBase {
34 public: 35 public:
35 WallpaperPrivateApiUnittest() 36 WallpaperPrivateApiUnittest()
36 : fake_user_manager_(new FakeChromeUserManager()), 37 : fake_user_manager_(new FakeChromeUserManager()),
37 scoped_user_manager_(fake_user_manager_) {} 38 scoped_user_manager_(fake_user_manager_) {}
38 39
39 protected: 40 protected:
40 FakeChromeUserManager* fake_user_manager() { return fake_user_manager_; } 41 FakeChromeUserManager* fake_user_manager() { return fake_user_manager_; }
41 42
42 const AccountId test_account_id1_ = AccountId::FromUserEmail(kTestAccount1); 43 const AccountId test_account_id1_ = AccountId::FromUserEmail(kTestAccount1);
43 const AccountId test_account_id2_ = AccountId::FromUserEmail(kTestAccount2); 44 const AccountId test_account_id2_ = AccountId::FromUserEmail(kTestAccount2);
44 45
45 private: 46 private:
46 FakeChromeUserManager* fake_user_manager_; 47 FakeChromeUserManager* fake_user_manager_;
47 ScopedUserManagerEnabler scoped_user_manager_; 48 ScopedUserManagerEnabler scoped_user_manager_;
48 49
49 DISALLOW_COPY_AND_ASSIGN(WallpaperPrivateApiUnittest); 50 DISALLOW_COPY_AND_ASSIGN(WallpaperPrivateApiUnittest);
50 }; 51 };
51 52
52 class TestMinimizeFunction 53 bool RunMinimizeFunction() {
53 : public WallpaperPrivateMinimizeInactiveWindowsFunction { 54 scoped_refptr<WallpaperPrivateMinimizeInactiveWindowsFunction> function(
54 public: 55 new WallpaperPrivateMinimizeInactiveWindowsFunction());
55 TestMinimizeFunction() {} 56 return extensions::api_test_utils::RunFunction(function.get(), "[]", nullptr);
57 }
56 58
57 bool RunAsync() override { 59 bool RunRestoreFunction() {
58 return WallpaperPrivateMinimizeInactiveWindowsFunction::RunAsync(); 60 scoped_refptr<WallpaperPrivateRestoreMinimizedWindowsFunction> function(
59 } 61 new WallpaperPrivateRestoreMinimizedWindowsFunction());
60 62 return extensions::api_test_utils::RunFunction(function.get(), "[]", nullptr);
61 protected: 63 }
62 ~TestMinimizeFunction() override {}
63 };
64
65 class TestRestoreFunction
66 : public WallpaperPrivateRestoreMinimizedWindowsFunction {
67 public:
68 TestRestoreFunction() {}
69
70 bool RunAsync() override {
71 return WallpaperPrivateRestoreMinimizedWindowsFunction::RunAsync();
72 }
73 protected:
74 ~TestRestoreFunction() override {}
75 };
76 64
77 } // namespace 65 } // namespace
78 66
79 TEST_F(WallpaperPrivateApiUnittest, HideAndRestoreWindows) { 67 TEST_F(WallpaperPrivateApiUnittest, HideAndRestoreWindows) {
80 fake_user_manager()->AddUser(test_account_id1_); 68 fake_user_manager()->AddUser(test_account_id1_);
81 std::unique_ptr<aura::Window> window4(CreateTestWindowInShellWithId(4)); 69 std::unique_ptr<aura::Window> window4(CreateTestWindowInShellWithId(4));
82 std::unique_ptr<aura::Window> window3(CreateTestWindowInShellWithId(3)); 70 std::unique_ptr<aura::Window> window3(CreateTestWindowInShellWithId(3));
83 std::unique_ptr<aura::Window> window2(CreateTestWindowInShellWithId(2)); 71 std::unique_ptr<aura::Window> window2(CreateTestWindowInShellWithId(2));
84 std::unique_ptr<aura::Window> window1(CreateTestWindowInShellWithId(1)); 72 std::unique_ptr<aura::Window> window1(CreateTestWindowInShellWithId(1));
85 std::unique_ptr<aura::Window> window0(CreateTestWindowInShellWithId(0)); 73 std::unique_ptr<aura::Window> window0(CreateTestWindowInShellWithId(0));
(...skipping 11 matching lines...) Expand all
97 EXPECT_FALSE(window0_state->IsMinimized()); 85 EXPECT_FALSE(window0_state->IsMinimized());
98 EXPECT_FALSE(window1_state->IsMinimized()); 86 EXPECT_FALSE(window1_state->IsMinimized());
99 EXPECT_FALSE(window2_state->IsMinimized()); 87 EXPECT_FALSE(window2_state->IsMinimized());
100 EXPECT_TRUE(window3_state->IsMinimized()); 88 EXPECT_TRUE(window3_state->IsMinimized());
101 EXPECT_FALSE(window4_state->IsMinimized()); 89 EXPECT_FALSE(window4_state->IsMinimized());
102 90
103 // We then activate window 0 (i.e. wallpaper picker) and call the minimize 91 // We then activate window 0 (i.e. wallpaper picker) and call the minimize
104 // function. 92 // function.
105 window0_state->Activate(); 93 window0_state->Activate();
106 EXPECT_TRUE(window0_state->IsActive()); 94 EXPECT_TRUE(window0_state->IsActive());
107 scoped_refptr<TestMinimizeFunction> minimize_function( 95 EXPECT_TRUE(RunMinimizeFunction());
108 new TestMinimizeFunction());
109 EXPECT_TRUE(minimize_function->RunAsync());
110 96
111 // All windows except window 0 should be minimized. 97 // All windows except window 0 should be minimized.
112 EXPECT_FALSE(window0_state->IsMinimized()); 98 EXPECT_FALSE(window0_state->IsMinimized());
113 EXPECT_TRUE(window1_state->IsMinimized()); 99 EXPECT_TRUE(window1_state->IsMinimized());
114 EXPECT_TRUE(window2_state->IsMinimized()); 100 EXPECT_TRUE(window2_state->IsMinimized());
115 EXPECT_TRUE(window3_state->IsMinimized()); 101 EXPECT_TRUE(window3_state->IsMinimized());
116 EXPECT_TRUE(window4_state->IsMinimized()); 102 EXPECT_TRUE(window4_state->IsMinimized());
117 103
118 // Activates window 4 and then minimizes it. 104 // Activates window 4 and then minimizes it.
119 window4_state->Activate(); 105 window4_state->Activate();
120 window4_state->Minimize(); 106 window4_state->Minimize();
121 107
122 // Then we destroy window 0 and call the restore function. 108 // Then we destroy window 0 and call the restore function.
123 window0.reset(); 109 window0.reset();
124 scoped_refptr<TestRestoreFunction> restore_function( 110 EXPECT_TRUE(RunRestoreFunction());
125 new TestRestoreFunction());
126 EXPECT_TRUE(restore_function->RunAsync());
127 111
128 // Windows 1 and 2 should no longer be minimized. Window 1 should again 112 // Windows 1 and 2 should no longer be minimized. Window 1 should again
129 // be maximized. Window 3 should still be minimized. Window 4 should remain 113 // be maximized. Window 3 should still be minimized. Window 4 should remain
130 // minimized since user interacted with it while wallpaper picker was open. 114 // minimized since user interacted with it while wallpaper picker was open.
131 EXPECT_TRUE(window1_state->IsMaximized()); 115 EXPECT_TRUE(window1_state->IsMaximized());
132 EXPECT_FALSE(window2_state->IsMinimized()); 116 EXPECT_FALSE(window2_state->IsMinimized());
133 EXPECT_TRUE(window3_state->IsMinimized()); 117 EXPECT_TRUE(window3_state->IsMinimized());
134 EXPECT_TRUE(window4_state->IsMinimized()); 118 EXPECT_TRUE(window4_state->IsMinimized());
135 } 119 }
136 120
137 // Test for multiple calls to |MinimizeInactiveWindows| before call 121 // Test for multiple calls to |MinimizeInactiveWindows| before call
138 // |RestoreWindows|: 122 // |RestoreWindows|:
139 // 1. If all window hasn't change their states, the following calls are noops. 123 // 1. If all window hasn't change their states, the following calls are noops.
140 // 2. If some windows are manually unminimized, the following call will minimize 124 // 2. If some windows are manually unminimized, the following call will minimize
141 // all the unminimized windows. 125 // all the unminimized windows.
142 TEST_F(WallpaperPrivateApiUnittest, HideAndManualUnminimizeWindows) { 126 TEST_F(WallpaperPrivateApiUnittest, HideAndManualUnminimizeWindows) {
143 fake_user_manager()->AddUser(test_account_id1_); 127 fake_user_manager()->AddUser(test_account_id1_);
144 std::unique_ptr<aura::Window> window1(CreateTestWindowInShellWithId(1)); 128 std::unique_ptr<aura::Window> window1(CreateTestWindowInShellWithId(1));
145 std::unique_ptr<aura::Window> window0(CreateTestWindowInShellWithId(0)); 129 std::unique_ptr<aura::Window> window0(CreateTestWindowInShellWithId(0));
146 130
147 ash::wm::WindowState* window0_state = ash::wm::GetWindowState(window0.get()); 131 ash::wm::WindowState* window0_state = ash::wm::GetWindowState(window0.get());
148 ash::wm::WindowState* window1_state = ash::wm::GetWindowState(window1.get()); 132 ash::wm::WindowState* window1_state = ash::wm::GetWindowState(window1.get());
149 133
150 // We then activate window 0 (i.e. wallpaper picker) and call the minimize 134 // We then activate window 0 (i.e. wallpaper picker) and call the minimize
151 // function. 135 // function.
152 window0_state->Activate(); 136 window0_state->Activate();
153 EXPECT_TRUE(window0_state->IsActive()); 137 EXPECT_TRUE(window0_state->IsActive());
154 scoped_refptr<TestMinimizeFunction> minimize_function_0( 138 EXPECT_TRUE(RunMinimizeFunction());
155 new TestMinimizeFunction());
156 EXPECT_TRUE(minimize_function_0->RunAsync());
157 139
158 // All windows except window 0 should be minimized. 140 // All windows except window 0 should be minimized.
159 EXPECT_FALSE(window0_state->IsMinimized()); 141 EXPECT_FALSE(window0_state->IsMinimized());
160 EXPECT_TRUE(window1_state->IsMinimized()); 142 EXPECT_TRUE(window1_state->IsMinimized());
161 143
162 // Calls minimize function again should be an noop if window state didn't 144 // Calls minimize function again should be an noop if window state didn't
163 // change. 145 // change.
164 scoped_refptr<TestMinimizeFunction> minimize_function_1( 146 EXPECT_TRUE(RunMinimizeFunction());
165 new TestMinimizeFunction());
166 EXPECT_TRUE(minimize_function_1->RunAsync());
167 147
168 // All windows except window 0 should be minimized. 148 // All windows except window 0 should be minimized.
169 EXPECT_FALSE(window0_state->IsMinimized()); 149 EXPECT_FALSE(window0_state->IsMinimized());
170 EXPECT_TRUE(window1_state->IsMinimized()); 150 EXPECT_TRUE(window1_state->IsMinimized());
171 151
172 // Manually unminimize window 1. 152 // Manually unminimize window 1.
173 window1_state->Unminimize(); 153 window1_state->Unminimize();
174 EXPECT_FALSE(window1_state->IsMinimized()); 154 EXPECT_FALSE(window1_state->IsMinimized());
175 window0_state->Activate(); 155 window0_state->Activate();
176 156
177 scoped_refptr<TestMinimizeFunction> minimize_function_2( 157 EXPECT_TRUE(RunMinimizeFunction());
178 new TestMinimizeFunction());
179 EXPECT_TRUE(minimize_function_2->RunAsync());
180 158
181 // Window 1 should be minimized again. 159 // Window 1 should be minimized again.
182 EXPECT_FALSE(window0_state->IsMinimized()); 160 EXPECT_FALSE(window0_state->IsMinimized());
183 EXPECT_TRUE(window1_state->IsMinimized()); 161 EXPECT_TRUE(window1_state->IsMinimized());
184 162
185 // Then we destroy window 0 and call the restore function. 163 // Then we destroy window 0 and call the restore function.
186 window0.reset(); 164 window0.reset();
187 scoped_refptr<TestRestoreFunction> restore_function( 165 EXPECT_TRUE(RunRestoreFunction());
188 new TestRestoreFunction());
189 EXPECT_TRUE(restore_function->RunAsync());
190 166
191 // Windows 1 should no longer be minimized. 167 // Windows 1 should no longer be minimized.
192 EXPECT_FALSE(window1_state->IsMinimized()); 168 EXPECT_FALSE(window1_state->IsMinimized());
193 } 169 }
194 170
195 class WallpaperPrivateApiMultiUserUnittest 171 class WallpaperPrivateApiMultiUserUnittest
196 : public WallpaperPrivateApiUnittest { 172 : public WallpaperPrivateApiUnittest {
197 public: 173 public:
198 WallpaperPrivateApiMultiUserUnittest() 174 WallpaperPrivateApiMultiUserUnittest()
199 : multi_user_window_manager_(NULL), 175 : multi_user_window_manager_(NULL),
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 EXPECT_FALSE(window0_state->IsMinimized()); 263 EXPECT_FALSE(window0_state->IsMinimized());
288 EXPECT_FALSE(window1_state->IsMinimized()); 264 EXPECT_FALSE(window1_state->IsMinimized());
289 EXPECT_FALSE(window2_state->IsMinimized()); 265 EXPECT_FALSE(window2_state->IsMinimized());
290 EXPECT_FALSE(window3_state->IsMinimized()); 266 EXPECT_FALSE(window3_state->IsMinimized());
291 EXPECT_FALSE(window4_state->IsMinimized()); 267 EXPECT_FALSE(window4_state->IsMinimized());
292 268
293 // We then activate window 0 (i.e. wallpaper picker) and call the minimize 269 // We then activate window 0 (i.e. wallpaper picker) and call the minimize
294 // function. 270 // function.
295 window0_state->Activate(); 271 window0_state->Activate();
296 EXPECT_TRUE(window0_state->IsActive()); 272 EXPECT_TRUE(window0_state->IsActive());
297 scoped_refptr<TestMinimizeFunction> minimize_function_0( 273 EXPECT_TRUE(RunMinimizeFunction());
298 new TestMinimizeFunction());
299 EXPECT_TRUE(minimize_function_0->RunAsync());
300 274
301 // All windows except window 0 should be minimized. 275 // All windows except window 0 should be minimized.
302 EXPECT_FALSE(window0_state->IsMinimized()); 276 EXPECT_FALSE(window0_state->IsMinimized());
303 EXPECT_TRUE(window1_state->IsMinimized()); 277 EXPECT_TRUE(window1_state->IsMinimized());
304 278
305 // All windows that belong to inactive user should not be affected. 279 // All windows that belong to inactive user should not be affected.
306 EXPECT_FALSE(window2_state->IsMinimized()); 280 EXPECT_FALSE(window2_state->IsMinimized());
307 EXPECT_FALSE(window3_state->IsMinimized()); 281 EXPECT_FALSE(window3_state->IsMinimized());
308 EXPECT_FALSE(window4_state->IsMinimized()); 282 EXPECT_FALSE(window4_state->IsMinimized());
309 283
310 // Activate kTestAccount2. kTestAccount1 becomes inactive user. 284 // Activate kTestAccount2. kTestAccount1 becomes inactive user.
311 SwitchActiveUser(test_account_id2_); 285 SwitchActiveUser(test_account_id2_);
312 286
313 window2_state->Activate(); 287 window2_state->Activate();
314 EXPECT_TRUE(window2_state->IsActive()); 288 EXPECT_TRUE(window2_state->IsActive());
315 scoped_refptr<TestMinimizeFunction> minimize_function_1( 289 EXPECT_TRUE(RunMinimizeFunction());
316 new TestMinimizeFunction());
317 EXPECT_TRUE(minimize_function_1->RunAsync());
318 290
319 // All windows except window 2 should be minimized. 291 // All windows except window 2 should be minimized.
320 EXPECT_FALSE(window2_state->IsMinimized()); 292 EXPECT_FALSE(window2_state->IsMinimized());
321 EXPECT_TRUE(window3_state->IsMinimized()); 293 EXPECT_TRUE(window3_state->IsMinimized());
322 EXPECT_TRUE(window4_state->IsMinimized()); 294 EXPECT_TRUE(window4_state->IsMinimized());
323 295
324 // All windows that belong to inactive user should not be affected. 296 // All windows that belong to inactive user should not be affected.
325 EXPECT_FALSE(window0_state->IsMinimized()); 297 EXPECT_FALSE(window0_state->IsMinimized());
326 EXPECT_TRUE(window1_state->IsMinimized()); 298 EXPECT_TRUE(window1_state->IsMinimized());
327 299
328 // Destroy window 4. Nothing should happen to other windows. 300 // Destroy window 4. Nothing should happen to other windows.
329 window4_state->Unminimize(); 301 window4_state->Unminimize();
330 window4.reset(); 302 window4.reset();
331 303
332 EXPECT_FALSE(window2_state->IsMinimized()); 304 EXPECT_FALSE(window2_state->IsMinimized());
333 EXPECT_TRUE(window3_state->IsMinimized()); 305 EXPECT_TRUE(window3_state->IsMinimized());
334 EXPECT_FALSE(window0_state->IsMinimized()); 306 EXPECT_FALSE(window0_state->IsMinimized());
335 EXPECT_TRUE(window1_state->IsMinimized()); 307 EXPECT_TRUE(window1_state->IsMinimized());
336 308
337 // Then we destroy window 2 and call the restore function. 309 // Then we destroy window 2 and call the restore function.
338 window2.reset(); 310 window2.reset();
339 scoped_refptr<TestRestoreFunction> restore_function_0( 311 EXPECT_TRUE(RunRestoreFunction());
340 new TestRestoreFunction());
341 EXPECT_TRUE(restore_function_0->RunAsync());
342 312
343 EXPECT_FALSE(window3_state->IsMinimized()); 313 EXPECT_FALSE(window3_state->IsMinimized());
344 314
345 // All windows that belong to inactive user should not be affected. 315 // All windows that belong to inactive user should not be affected.
346 EXPECT_FALSE(window0_state->IsMinimized()); 316 EXPECT_FALSE(window0_state->IsMinimized());
347 EXPECT_TRUE(window1_state->IsMinimized()); 317 EXPECT_TRUE(window1_state->IsMinimized());
348 318
349 SwitchActiveUser(test_account_id1_); 319 SwitchActiveUser(test_account_id1_);
350 320
351 // Then we destroy window 0 and call the restore function. 321 // Then we destroy window 0 and call the restore function.
352 window0.reset(); 322 window0.reset();
353 scoped_refptr<TestRestoreFunction> restore_function_1( 323 EXPECT_TRUE(RunRestoreFunction());
354 new TestRestoreFunction());
355 EXPECT_TRUE(restore_function_1->RunAsync());
356 324
357 EXPECT_FALSE(window1_state->IsMinimized()); 325 EXPECT_FALSE(window1_state->IsMinimized());
358 EXPECT_FALSE(window3_state->IsMinimized()); 326 EXPECT_FALSE(window3_state->IsMinimized());
359 } 327 }
360 328
361 // In multi profile mode, user may teleport windows. Teleported window should 329 // In multi profile mode, user may teleport windows. Teleported window should
362 // also be minimized when open wallpaper picker. 330 // also be minimized when open wallpaper picker.
363 TEST_F(WallpaperPrivateApiMultiUserUnittest, HideTeleportedWindow) { 331 TEST_F(WallpaperPrivateApiMultiUserUnittest, HideTeleportedWindow) {
364 SetUpMultiUserWindowManager( 332 SetUpMultiUserWindowManager(
365 AccountId::FromUserEmail(kTestAccount1), 333 AccountId::FromUserEmail(kTestAccount1),
(...skipping 23 matching lines...) Expand all
389 // Initial window state. All windows shouldn't be minimized. 357 // Initial window state. All windows shouldn't be minimized.
390 EXPECT_FALSE(window0_state->IsMinimized()); 358 EXPECT_FALSE(window0_state->IsMinimized());
391 EXPECT_FALSE(window1_state->IsMinimized()); 359 EXPECT_FALSE(window1_state->IsMinimized());
392 EXPECT_FALSE(window2_state->IsMinimized()); 360 EXPECT_FALSE(window2_state->IsMinimized());
393 EXPECT_FALSE(window3_state->IsMinimized()); 361 EXPECT_FALSE(window3_state->IsMinimized());
394 362
395 // We then activate window 0 (i.e. wallpaper picker) and call the minimize 363 // We then activate window 0 (i.e. wallpaper picker) and call the minimize
396 // function. 364 // function.
397 window0_state->Activate(); 365 window0_state->Activate();
398 EXPECT_TRUE(window0_state->IsActive()); 366 EXPECT_TRUE(window0_state->IsActive());
399 scoped_refptr<TestMinimizeFunction> minimize_function_0( 367 EXPECT_TRUE(RunMinimizeFunction());
400 new TestMinimizeFunction());
401 EXPECT_TRUE(minimize_function_0->RunAsync());
402 368
403 // All windows except window 0 should be minimized. 369 // All windows except window 0 should be minimized.
404 EXPECT_FALSE(window0_state->IsMinimized()); 370 EXPECT_FALSE(window0_state->IsMinimized());
405 EXPECT_TRUE(window1_state->IsMinimized()); 371 EXPECT_TRUE(window1_state->IsMinimized());
406 372
407 // Teleported window should also be minimized. 373 // Teleported window should also be minimized.
408 EXPECT_TRUE(window2_state->IsMinimized()); 374 EXPECT_TRUE(window2_state->IsMinimized());
409 // Other window should remain the same. 375 // Other window should remain the same.
410 EXPECT_FALSE(window3_state->IsMinimized()); 376 EXPECT_FALSE(window3_state->IsMinimized());
411 377
412 // Then we destroy window 0 and call the restore function. 378 // Then we destroy window 0 and call the restore function.
413 window0.reset(); 379 window0.reset();
414 scoped_refptr<TestRestoreFunction> restore_function_1( 380 EXPECT_TRUE(RunRestoreFunction());
415 new TestRestoreFunction());
416 EXPECT_TRUE(restore_function_1->RunAsync());
417 381
418 EXPECT_FALSE(window1_state->IsMinimized()); 382 EXPECT_FALSE(window1_state->IsMinimized());
419 EXPECT_FALSE(window2_state->IsMinimized()); 383 EXPECT_FALSE(window2_state->IsMinimized());
420 EXPECT_FALSE(window3_state->IsMinimized()); 384 EXPECT_FALSE(window3_state->IsMinimized());
421 } 385 }
422 386
423 } // namespace chromeos 387 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698