| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2009 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 "base/basictypes.h" |
| 6 #include "chrome/browser/app_modal_dialog_delegate.h" |
| 7 #include "chrome/browser/app_modal_dialog_queue.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 |
| 10 namespace { |
| 11 |
| 12 class TestModalDialogDelegate : public AppModalDialogDelegate { |
| 13 public: |
| 14 TestModalDialogDelegate() {} |
| 15 virtual ~TestModalDialogDelegate() {} |
| 16 |
| 17 // Overridden from AppModalDialogDelegate: |
| 18 virtual void ShowModalDialog() {} |
| 19 virtual void ActivateModalDialog() {} |
| 20 virtual AppModalDialogDelegateTesting* GetTestingInterface() { return NULL; } |
| 21 |
| 22 private: |
| 23 DISALLOW_COPY_AND_ASSIGN(TestModalDialogDelegate); |
| 24 }; |
| 25 |
| 26 } // namespace |
| 27 |
| 28 TEST(AppModalDialogQueueTest, MultipleDialogTest) { |
| 29 TestModalDialogDelegate modal_dialog1, modal_dialog2; |
| 30 AppModalDialogQueue::AddDialog(&modal_dialog1); |
| 31 AppModalDialogQueue::AddDialog(&modal_dialog2); |
| 32 |
| 33 EXPECT_TRUE(AppModalDialogQueue::HasActiveDialog()); |
| 34 EXPECT_EQ(&modal_dialog1, AppModalDialogQueue::active_dialog()); |
| 35 |
| 36 AppModalDialogQueue::ShowNextDialog(); |
| 37 |
| 38 EXPECT_TRUE(AppModalDialogQueue::HasActiveDialog()); |
| 39 EXPECT_EQ(&modal_dialog2, AppModalDialogQueue::active_dialog()); |
| 40 |
| 41 AppModalDialogQueue::ShowNextDialog(); |
| 42 |
| 43 EXPECT_FALSE(AppModalDialogQueue::HasActiveDialog()); |
| 44 EXPECT_EQ(NULL, AppModalDialogQueue::active_dialog()); |
| 45 } |
| OLD | NEW |