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.h" | 12 #include "chrome/browser/ui/tab_contents/tab_contents.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/public/test/test_browser_thread.h" | 18 #include "content/public/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/aura_constants.h" |
22 #include "ui/aura/client/activation_delegate.h" | 22 #include "ui/aura/client/activation_delegate.h" |
23 #include "ui/aura/root_window.h" | 23 #include "ui/aura/root_window.h" |
24 #include "ui/aura/test/test_activation_client.h" | 24 #include "ui/aura/test/test_activation_client.h" |
25 #include "ui/aura/test/test_window_delegate.h" | 25 #include "ui/aura/test/test_window_delegate.h" |
26 #include "ui/aura/window.h" | 26 #include "ui/aura/window.h" |
27 #include "ui/aura/window_delegate.h" | 27 #include "ui/aura/window_delegate.h" |
| 28 #include "ui/base/event.h" |
28 | 29 |
29 namespace { | 30 namespace { |
30 | 31 |
31 // Test implementation of AppTabHelper | 32 // Test implementation of AppTabHelper |
32 class AppTabHelperImpl : public ChromeLauncherController::AppTabHelper { | 33 class AppTabHelperImpl : public ChromeLauncherController::AppTabHelper { |
33 public: | 34 public: |
34 AppTabHelperImpl() {} | 35 AppTabHelperImpl() {} |
35 virtual ~AppTabHelperImpl() {} | 36 virtual ~AppTabHelperImpl() {} |
36 | 37 |
37 // Sets the id for the specified tab. The id is removed if Remove() is | 38 // Sets the id for the specified tab. The id is removed if Remove() is |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 } | 146 } |
146 | 147 |
147 ash::LauncherItem GetUpdaterItem() { | 148 ash::LauncherItem GetUpdaterItem() { |
148 ash::LauncherID launcher_id = | 149 ash::LauncherID launcher_id = |
149 BrowserLauncherItemController::TestApi(&updater).item_id(); | 150 BrowserLauncherItemController::TestApi(&updater).item_id(); |
150 int index = launcher_test->launcher_model_->ItemIndexByID(launcher_id); | 151 int index = launcher_test->launcher_model_->ItemIndexByID(launcher_id); |
151 return launcher_test->launcher_model_->items()[index]; | 152 return launcher_test->launcher_model_->items()[index]; |
152 } | 153 } |
153 | 154 |
154 // aura::client::ActivationDelegate overrides. | 155 // aura::client::ActivationDelegate overrides. |
155 virtual bool ShouldActivate(const aura::Event* event) OVERRIDE { | 156 virtual bool ShouldActivate(const ui::Event* event) OVERRIDE { |
156 return true; | 157 return true; |
157 } | 158 } |
158 virtual void OnActivated() OVERRIDE { | 159 virtual void OnActivated() OVERRIDE { |
159 updater.BrowserActivationStateChanged(); | 160 updater.BrowserActivationStateChanged(); |
160 } | 161 } |
161 virtual void OnLostActive() OVERRIDE { | 162 virtual void OnLostActive() OVERRIDE { |
162 updater.BrowserActivationStateChanged(); | 163 updater.BrowserActivationStateChanged(); |
163 } | 164 } |
164 | 165 |
165 BrowserLauncherItemControllerTest* launcher_test; | 166 BrowserLauncherItemControllerTest* launcher_test; |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 EXPECT_EQ(ash::STATUS_RUNNING, app_state.GetUpdaterItem().status); | 403 EXPECT_EQ(ash::STATUS_RUNNING, app_state.GetUpdaterItem().status); |
403 | 404 |
404 // App window should go to attention state. | 405 // App window should go to attention state. |
405 app_state.window.SetProperty(aura::client::kDrawAttentionKey, true); | 406 app_state.window.SetProperty(aura::client::kDrawAttentionKey, true); |
406 EXPECT_EQ(ash::STATUS_ATTENTION, app_state.GetUpdaterItem().status); | 407 EXPECT_EQ(ash::STATUS_ATTENTION, app_state.GetUpdaterItem().status); |
407 | 408 |
408 // Activating app window should clear attention state. | 409 // Activating app window should clear attention state. |
409 activation_client_->ActivateWindow(&app_state.window); | 410 activation_client_->ActivateWindow(&app_state.window); |
410 EXPECT_EQ(ash::STATUS_ACTIVE, app_state.GetUpdaterItem().status); | 411 EXPECT_EQ(ash::STATUS_ACTIVE, app_state.GetUpdaterItem().status); |
411 } | 412 } |
OLD | NEW |