| 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "chrome/browser/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
| 7 #include "chrome/browser/ui/webui/test_web_dialog_delegate.h" | 7 #include "chrome/browser/ui/webui/test_web_dialog_delegate.h" |
| 8 #include "chrome/common/url_constants.h" | 8 #include "chrome/common/url_constants.h" |
| 9 #include "chrome/test/base/in_process_browser_test.h" | 9 #include "chrome/test/base/in_process_browser_test.h" |
| 10 #include "chrome/test/base/ui_test_utils.h" | 10 #include "chrome/test/base/ui_test_utils.h" |
| 11 #include "testing/gmock/include/gmock/gmock.h" | 11 #include "testing/gmock/include/gmock/gmock.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 class TestDialogClosedDelegate : public test::TestWebDialogDelegate { | 16 class TestDialogClosedDelegate : public test::TestWebDialogDelegate { |
| 17 public: | 17 public: |
| 18 TestDialogClosedDelegate() | 18 TestDialogClosedDelegate() |
| 19 : test::TestWebDialogDelegate( | 19 : test::TestWebDialogDelegate( |
| 20 GURL(chrome::kChromeUIChromeURLsURL)), | 20 GURL(chrome::kChromeUIChromeURLsURL)), |
| 21 dialog_closed_(false) { | 21 dialog_closed_(false) { |
| 22 } | 22 } |
| 23 | 23 |
| 24 bool dialog_closed() const { return dialog_closed_; } | 24 bool dialog_closed() const { return dialog_closed_; } |
| 25 | 25 |
| 26 // Overridden from WebDialogDelegate: | 26 // Overridden from ui::WebDialogDelegate: |
| 27 virtual ui::ModalType GetDialogModalType() const OVERRIDE { | 27 virtual ui::ModalType GetDialogModalType() const OVERRIDE { |
| 28 return ui::MODAL_TYPE_NONE; | 28 return ui::MODAL_TYPE_NONE; |
| 29 } | 29 } |
| 30 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE { | 30 virtual void OnDialogClosed(const std::string& json_retval) OVERRIDE { |
| 31 dialog_closed_ = true; | 31 dialog_closed_ = true; |
| 32 } | 32 } |
| 33 | 33 |
| 34 private: | 34 private: |
| 35 bool dialog_closed_; | 35 bool dialog_closed_; |
| 36 | 36 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 54 // expect. | 54 // expect. |
| 55 browser->BrowserShowWebDialog(delegate.get(), NULL); | 55 browser->BrowserShowWebDialog(delegate.get(), NULL); |
| 56 ui_test_utils::RunAllPendingInMessageLoop(); | 56 ui_test_utils::RunAllPendingInMessageLoop(); |
| 57 ASSERT_FALSE(delegate->dialog_closed()); | 57 ASSERT_FALSE(delegate->dialog_closed()); |
| 58 | 58 |
| 59 // Closing the browser should close the dialogs associated with that browser. | 59 // Closing the browser should close the dialogs associated with that browser. |
| 60 browser->CloseWindow(); | 60 browser->CloseWindow(); |
| 61 ui_test_utils::RunAllPendingInMessageLoop(); | 61 ui_test_utils::RunAllPendingInMessageLoop(); |
| 62 ASSERT_TRUE(delegate->dialog_closed()); | 62 ASSERT_TRUE(delegate->dialog_closed()); |
| 63 } | 63 } |
| OLD | NEW |