| 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 "ash/system/tray/system_tray.h" | 5 #include "ash/system/tray/system_tray.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "ash/system/status_area_widget.h" | 9 #include "ash/system/status_area_widget.h" |
| 10 #include "ash/system/tray/system_tray_item.h" | 10 #include "ash/system/tray/system_tray_item.h" |
| 11 #include "ash/test/ash_test_base.h" | 11 #include "ash/test/ash_test_base.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "ui/views/controls/label.h" | 13 #include "ui/views/controls/label.h" |
| 14 #include "ui/views/layout/fill_layout.h" | 14 #include "ui/views/layout/fill_layout.h" |
| 15 #include "ui/views/view.h" | 15 #include "ui/views/view.h" |
| 16 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
| 17 | 17 |
| 18 namespace ash { | 18 namespace ash { |
| 19 namespace test { | 19 namespace test { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 SystemTray* CreateSystemTray() { | 23 SystemTray* CreateSystemTray() { |
| 24 SystemTray* tray = new SystemTray; | |
| 25 internal::StatusAreaWidget* widget = new internal::StatusAreaWidget; | 24 internal::StatusAreaWidget* widget = new internal::StatusAreaWidget; |
| 26 widget->AddTray(tray); | 25 widget->CreateTrayViews(NULL); |
| 27 tray->CreateItems(); | |
| 28 widget->Show(); | 26 widget->Show(); |
| 29 return tray; | 27 return widget->system_tray(); |
| 30 } | 28 } |
| 31 | 29 |
| 32 // Trivial item implementation that tracks its views for testing. | 30 // Trivial item implementation that tracks its views for testing. |
| 33 class TestItem : public SystemTrayItem { | 31 class TestItem : public SystemTrayItem { |
| 34 public: | 32 public: |
| 35 TestItem() : tray_view_(NULL) {} | 33 TestItem() : tray_view_(NULL) {} |
| 36 | 34 |
| 37 virtual views::View* CreateTrayView(user::LoginStatus status) { | 35 virtual views::View* CreateTrayView(user::LoginStatus status) { |
| 38 tray_view_ = new views::View; | 36 tray_view_ = new views::View; |
| 39 // Add a label so it has non-zero width. | 37 // Add a label so it has non-zero width. |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 tray->ShowDefaultView(BUBBLE_USE_EXISTING); | 227 tray->ShowDefaultView(BUBBLE_USE_EXISTING); |
| 230 RunAllPendingInMessageLoop(); | 228 RunAllPendingInMessageLoop(); |
| 231 | 229 |
| 232 EXPECT_EQ(bubble_bounds.ToString(), test_item->default_view()->GetWidget()-> | 230 EXPECT_EQ(bubble_bounds.ToString(), test_item->default_view()->GetWidget()-> |
| 233 GetWindowScreenBounds().ToString()); | 231 GetWindowScreenBounds().ToString()); |
| 234 EXPECT_EQ(widget, test_item->default_view()->GetWidget()); | 232 EXPECT_EQ(widget, test_item->default_view()->GetWidget()); |
| 235 } | 233 } |
| 236 | 234 |
| 237 } // namespace test | 235 } // namespace test |
| 238 } // namespace ash | 236 } // namespace ash |
| OLD | NEW |