| 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/root_window_controller.h" | 9 #include "ash/root_window_controller.h" |
| 10 #include "ash/system/status_area_widget.h" | 10 #include "ash/system/status_area_widget.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 SystemTray* GetSystemTray() { | 24 SystemTray* GetSystemTray() { |
| 25 return Shell::GetPrimaryRootWindowController()->status_area_widget()-> | 25 return Shell::GetPrimaryRootWindowController()->status_area_widget()-> |
| 26 system_tray(); | 26 system_tray(); |
| 27 } | 27 } |
| 28 | 28 |
| 29 // Trivial item implementation that tracks its views for testing. | 29 // Trivial item implementation that tracks its views for testing. |
| 30 class TestItem : public SystemTrayItem { | 30 class TestItem : public SystemTrayItem { |
| 31 public: | 31 public: |
| 32 TestItem() : tray_view_(NULL) {} | 32 TestItem() : SystemTrayItem(GetSystemTray()), tray_view_(NULL) {} |
| 33 | 33 |
| 34 virtual views::View* CreateTrayView(user::LoginStatus status) { | 34 virtual views::View* CreateTrayView(user::LoginStatus status) { |
| 35 tray_view_ = new views::View; | 35 tray_view_ = new views::View; |
| 36 // Add a label so it has non-zero width. | 36 // Add a label so it has non-zero width. |
| 37 tray_view_->SetLayoutManager(new views::FillLayout); | 37 tray_view_->SetLayoutManager(new views::FillLayout); |
| 38 tray_view_->AddChildView(new views::Label(UTF8ToUTF16("Tray"))); | 38 tray_view_->AddChildView(new views::Label(UTF8ToUTF16("Tray"))); |
| 39 return tray_view_; | 39 return tray_view_; |
| 40 } | 40 } |
| 41 | 41 |
| 42 virtual views::View* CreateDefaultView(user::LoginStatus status) { | 42 virtual views::View* CreateDefaultView(user::LoginStatus status) { |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 tray->ShowDefaultView(BUBBLE_USE_EXISTING); | 229 tray->ShowDefaultView(BUBBLE_USE_EXISTING); |
| 230 RunAllPendingInMessageLoop(); | 230 RunAllPendingInMessageLoop(); |
| 231 | 231 |
| 232 EXPECT_EQ(bubble_bounds.ToString(), test_item->default_view()->GetWidget()-> | 232 EXPECT_EQ(bubble_bounds.ToString(), test_item->default_view()->GetWidget()-> |
| 233 GetWindowBoundsInScreen().ToString()); | 233 GetWindowBoundsInScreen().ToString()); |
| 234 EXPECT_EQ(widget, test_item->default_view()->GetWidget()); | 234 EXPECT_EQ(widget, test_item->default_view()->GetWidget()); |
| 235 } | 235 } |
| 236 | 236 |
| 237 } // namespace test | 237 } // namespace test |
| 238 } // namespace ash | 238 } // namespace ash |
| OLD | NEW |