Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ash/display/display_error_dialog.h" | |
| 6 | |
| 7 #include "ash/test/ash_test_base.h" | |
| 8 | |
| 9 namespace ash { | |
| 10 namespace internal { | |
| 11 | |
| 12 typedef test::AshTestBase DisplayErrorDialogTest; | |
| 13 | |
| 14 // The test cases in this file usually check if the showing dialog doesn't | |
| 15 // cause any crashes, and the code doesn't cause any memory leaks. | |
| 16 TEST_F(DisplayErrorDialogTest, Normal) { | |
| 17 UpdateDisplay("200x200,300x300"); | |
| 18 DisplayErrorDialog::ShowDialog(); | |
| 19 DisplayErrorDialog* dialog = DisplayErrorDialog::GetInstanceForTest(); | |
| 20 EXPECT_TRUE(dialog); | |
| 21 EXPECT_TRUE(dialog->GetWidget()->IsVisible()); | |
|
James Cook
2013/02/05 23:59:52
Does this need to manually close the widget at the
oshima
2013/02/06 00:17:28
If the widget's ownership is NATIVE_WIDGET_OWNS_WI
| |
| 22 } | |
| 23 | |
| 24 TEST_F(DisplayErrorDialogTest, CallTwice) { | |
| 25 UpdateDisplay("200x200,300x300"); | |
| 26 DisplayErrorDialog::ShowDialog(); | |
| 27 DisplayErrorDialog* dialog = DisplayErrorDialog::GetInstanceForTest(); | |
| 28 EXPECT_TRUE(dialog); | |
| 29 DisplayErrorDialog::ShowDialog(); | |
| 30 EXPECT_EQ(dialog, DisplayErrorDialog::GetInstanceForTest()); | |
|
oshima
2013/02/06 00:17:28
can you test if the dialog is on the right root wi
Jun Mukai
2013/02/06 00:37:18
Done.
| |
| 31 } | |
| 32 | |
| 33 TEST_F(DisplayErrorDialogTest, SingleDisplay) { | |
| 34 UpdateDisplay("200x200"); | |
| 35 DisplayErrorDialog::ShowDialog(); | |
| 36 DisplayErrorDialog* dialog = DisplayErrorDialog::GetInstanceForTest(); | |
| 37 EXPECT_TRUE(dialog); | |
| 38 EXPECT_TRUE(dialog->GetWidget()->IsVisible()); | |
| 39 } | |
| 40 | |
| 41 TEST_F(DisplayErrorDialogTest, DisplayDisconnected) { | |
| 42 UpdateDisplay("200x200,300x300"); | |
| 43 DisplayErrorDialog::ShowDialog(); | |
| 44 DisplayErrorDialog* dialog = DisplayErrorDialog::GetInstanceForTest(); | |
| 45 EXPECT_TRUE(dialog); | |
| 46 | |
| 47 UpdateDisplay("200x200"); | |
| 48 // Disconnection will close the dialog but we have to run all pending tasks | |
| 49 // to make the effect of the close. | |
| 50 RunAllPendingInMessageLoop(); | |
| 51 EXPECT_FALSE(DisplayErrorDialog::GetInstanceForTest()); | |
| 52 } | |
| 53 | |
| 54 } // namespace internal | |
| 55 } // namespace ash | |
| OLD | NEW |