OLD | NEW |
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/ui/views/ash/launcher/browser_launcher_item_controller.
h" | 5 #include "chrome/browser/ui/views/ash/launcher/browser_launcher_item_controller.
h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ash/launcher/launcher_model.h" | 10 #include "ash/launcher/launcher_model.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 12 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 13 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
14 #include "chrome/browser/ui/tabs/test_tab_strip_model_delegate.h" | 14 #include "chrome/browser/ui/tabs/test_tab_strip_model_delegate.h" |
15 #include "chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.h" | 15 #include "chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.h" |
16 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 16 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
17 #include "chrome/test/base/testing_profile.h" | 17 #include "chrome/test/base/testing_profile.h" |
18 #include "content/test/test_browser_thread.h" | 18 #include "content/test/test_browser_thread.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 #include "third_party/skia/include/core/SkBitmap.h" | 20 #include "third_party/skia/include/core/SkBitmap.h" |
| 21 #include "ui/aura/client/aura_constants.h" |
21 #include "ui/aura/client/activation_delegate.h" | 22 #include "ui/aura/client/activation_delegate.h" |
22 #include "ui/aura/root_window.h" | 23 #include "ui/aura/root_window.h" |
23 #include "ui/aura/test/test_activation_client.h" | 24 #include "ui/aura/test/test_activation_client.h" |
24 #include "ui/aura/test/test_window_delegate.h" | 25 #include "ui/aura/test/test_window_delegate.h" |
25 #include "ui/aura/window.h" | 26 #include "ui/aura/window.h" |
26 #include "ui/aura/window_delegate.h" | 27 #include "ui/aura/window_delegate.h" |
27 | 28 |
28 namespace { | 29 namespace { |
29 | 30 |
30 // Test implementation of AppIconLoader. | 31 // Test implementation of AppIconLoader. |
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 EXPECT_EQ(&state1.window, activation_client_->GetActiveWindow()); | 356 EXPECT_EQ(&state1.window, activation_client_->GetActiveWindow()); |
356 | 357 |
357 // And to the second item active. | 358 // And to the second item active. |
358 ash::LauncherItem new_item2(launcher_model_->items()[index2]); | 359 ash::LauncherItem new_item2(launcher_model_->items()[index2]); |
359 new_item2.status = ash::STATUS_ACTIVE; | 360 new_item2.status = ash::STATUS_ACTIVE; |
360 launcher_model_->Set(index2, new_item2); | 361 launcher_model_->Set(index2, new_item2); |
361 EXPECT_EQ(ash::STATUS_RUNNING, launcher_model_->items()[index1].status); | 362 EXPECT_EQ(ash::STATUS_RUNNING, launcher_model_->items()[index1].status); |
362 EXPECT_EQ(ash::STATUS_ACTIVE, launcher_model_->items()[index2].status); | 363 EXPECT_EQ(ash::STATUS_ACTIVE, launcher_model_->items()[index2].status); |
363 EXPECT_EQ(&state2.window, activation_client_->GetActiveWindow()); | 364 EXPECT_EQ(&state2.window, activation_client_->GetActiveWindow()); |
364 } | 365 } |
| 366 |
| 367 // Test attention states of windows. |
| 368 TEST_F(BrowserLauncherItemControllerTest, FlashWindow) { |
| 369 // App panel first |
| 370 State app_state(this, "1", BrowserLauncherItemController::TYPE_APP_PANEL); |
| 371 EXPECT_EQ(ash::STATUS_ACTIVE, app_state.GetUpdaterItem().status); |
| 372 |
| 373 // Active windows don't show attention. |
| 374 app_state.window.SetProperty(aura::client::kDrawAttentionKey, true); |
| 375 EXPECT_EQ(ash::STATUS_ACTIVE, app_state.GetUpdaterItem().status); |
| 376 |
| 377 // Then browser window |
| 378 State browser_state( |
| 379 this, std::string(), BrowserLauncherItemController::TYPE_TABBED); |
| 380 // First browser is active. |
| 381 EXPECT_EQ(ash::STATUS_ACTIVE, browser_state.GetUpdaterItem().status); |
| 382 EXPECT_EQ(ash::STATUS_RUNNING, app_state.GetUpdaterItem().status); |
| 383 |
| 384 // App window should go to attention state. |
| 385 app_state.window.SetProperty(aura::client::kDrawAttentionKey, true); |
| 386 EXPECT_EQ(ash::STATUS_ATTENTION, app_state.GetUpdaterItem().status); |
| 387 |
| 388 // Activating app window should clear attention state. |
| 389 activation_client_->ActivateWindow(&app_state.window); |
| 390 EXPECT_EQ(ash::STATUS_ACTIVE, app_state.GetUpdaterItem().status); |
| 391 } |
OLD | NEW |