| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/message_center/views/message_popup_collection.h" | 5 #include "ui/message_center/views/message_popup_collection.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 namespace message_center { | 24 namespace message_center { |
| 25 namespace test { | 25 namespace test { |
| 26 | 26 |
| 27 class MessagePopupCollectionTest : public views::ViewsTestBase { | 27 class MessagePopupCollectionTest : public views::ViewsTestBase { |
| 28 public: | 28 public: |
| 29 virtual void SetUp() OVERRIDE { | 29 virtual void SetUp() OVERRIDE { |
| 30 views::ViewsTestBase::SetUp(); | 30 views::ViewsTestBase::SetUp(); |
| 31 MessageCenter::Initialize(); | 31 MessageCenter::Initialize(); |
| 32 MessageCenter::Get()->DisableTimersForTest(); | 32 MessageCenter::Get()->DisableTimersForTest(); |
| 33 alignment_delegate_.reset(new DesktopPopupAlignmentDelegate); | 33 alignment_delegate_.reset(new DesktopPopupAlignmentDelegate); |
| 34 |
| 35 gfx::NativeView parent = NULL; |
| 36 #if defined(USE_ASH) |
| 37 // On ChromeOS the parent is a special container window. In tests, provide |
| 38 // the root window instead. Note on a Windows ash build the parent is later |
| 39 // NULLed out, because the message center is managed in desktop mode only. |
| 40 parent = GetContext(); |
| 41 #endif |
| 34 collection_.reset(new MessagePopupCollection( | 42 collection_.reset(new MessagePopupCollection( |
| 35 GetContext(), MessageCenter::Get(), NULL, alignment_delegate_.get())); | 43 parent, MessageCenter::Get(), NULL, alignment_delegate_.get())); |
| 36 // This size fits test machines resolution and also can keep a few toasts | 44 // This size fits test machines resolution and also can keep a few toasts |
| 37 // w/o ill effects of hitting the screen overflow. This allows us to assume | 45 // w/o ill effects of hitting the screen overflow. This allows us to assume |
| 38 // and verify normal layout of the toast stack. | 46 // and verify normal layout of the toast stack. |
| 39 SetDisplayInfo(gfx::Rect(0, 0, 600, 390), // taskbar at the bottom. | 47 SetDisplayInfo(gfx::Rect(0, 0, 600, 390), // taskbar at the bottom. |
| 40 gfx::Rect(0, 0, 600, 400)); | 48 gfx::Rect(0, 0, 600, 400)); |
| 41 id_ = 0; | 49 id_ = 0; |
| 42 PrepareForWait(); | 50 PrepareForWait(); |
| 43 } | 51 } |
| 44 | 52 |
| 45 virtual void TearDown() OVERRIDE { | 53 virtual void TearDown() OVERRIDE { |
| (...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 std::string id2 = AddNotification(); | 420 std::string id2 = AddNotification(); |
| 413 | 421 |
| 414 WaitForTransitionsDone(); | 422 WaitForTransitionsDone(); |
| 415 views::WidgetDelegateView* toast2 = GetToast(id2); | 423 views::WidgetDelegateView* toast2 = GetToast(id2); |
| 416 EXPECT_TRUE(toast2 != NULL); | 424 EXPECT_TRUE(toast2 != NULL); |
| 417 } | 425 } |
| 418 | 426 |
| 419 | 427 |
| 420 } // namespace test | 428 } // namespace test |
| 421 } // namespace message_center | 429 } // namespace message_center |
| OLD | NEW |