| 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 #ifndef CHROME_BROWSER_UI_TAB_MODAL_CONFIRM_DIALOG_BROWSERTEST_H_ | 5 #ifndef CHROME_BROWSER_UI_TAB_MODAL_CONFIRM_DIALOG_BROWSERTEST_H_ |
| 6 #define CHROME_BROWSER_UI_TAB_MODAL_CONFIRM_DIALOG_BROWSERTEST_H_ | 6 #define CHROME_BROWSER_UI_TAB_MODAL_CONFIRM_DIALOG_BROWSERTEST_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" | 10 #include "chrome/browser/ui/tab_modal_confirm_dialog.h" |
| 11 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" | 11 #include "chrome/browser/ui/tab_modal_confirm_dialog_delegate.h" |
| 12 #include "chrome/test/base/in_process_browser_test.h" | 12 #include "chrome/test/base/in_process_browser_test.h" |
| 13 | 13 |
| 14 class MockTabModalConfirmDialogDelegate : public TabModalConfirmDialogDelegate { | 14 class MockTabModalConfirmDialogDelegate : public TabModalConfirmDialogDelegate { |
| 15 public: | 15 public: |
| 16 class Delegate { | 16 class Delegate { |
| 17 public: | 17 public: |
| 18 virtual void OnAccepted() = 0; | 18 virtual void OnAccepted() = 0; |
| 19 virtual void OnCanceled() = 0; | 19 virtual void OnCanceled() = 0; |
| 20 virtual void OnClosed() = 0; |
| 20 protected: | 21 protected: |
| 21 virtual ~Delegate() {} | 22 virtual ~Delegate() {} |
| 22 }; | 23 }; |
| 23 | 24 |
| 24 MockTabModalConfirmDialogDelegate(Delegate* delegate); | 25 MockTabModalConfirmDialogDelegate(Delegate* delegate); |
| 25 virtual ~MockTabModalConfirmDialogDelegate(); | 26 virtual ~MockTabModalConfirmDialogDelegate(); |
| 26 | 27 |
| 27 virtual string16 GetTitle() OVERRIDE; | 28 virtual string16 GetTitle() OVERRIDE; |
| 28 virtual string16 GetMessage() OVERRIDE; | 29 virtual string16 GetMessage() OVERRIDE; |
| 29 | 30 |
| 30 virtual void OnAccepted() OVERRIDE; | 31 virtual void OnAccepted() OVERRIDE; |
| 31 virtual void OnCanceled() OVERRIDE; | 32 virtual void OnCanceled() OVERRIDE; |
| 33 virtual void OnClosed() OVERRIDE; |
| 32 | 34 |
| 33 private: | 35 private: |
| 34 Delegate* delegate_; | 36 Delegate* delegate_; |
| 35 | 37 |
| 36 DISALLOW_COPY_AND_ASSIGN(MockTabModalConfirmDialogDelegate); | 38 DISALLOW_COPY_AND_ASSIGN(MockTabModalConfirmDialogDelegate); |
| 37 }; | 39 }; |
| 38 | 40 |
| 39 class TabModalConfirmDialogTest | 41 class TabModalConfirmDialogTest |
| 40 : public InProcessBrowserTest, | 42 : public InProcessBrowserTest, |
| 41 public MockTabModalConfirmDialogDelegate::Delegate { | 43 public MockTabModalConfirmDialogDelegate::Delegate { |
| 42 public: | 44 public: |
| 43 TabModalConfirmDialogTest(); | 45 TabModalConfirmDialogTest(); |
| 44 | 46 |
| 45 virtual void SetUpOnMainThread() OVERRIDE; | 47 virtual void SetUpOnMainThread() OVERRIDE; |
| 46 virtual void CleanUpOnMainThread() OVERRIDE; | 48 virtual void CleanUpOnMainThread() OVERRIDE; |
| 47 | 49 |
| 48 // MockTabModalConfirmDialogDelegate::Delegate: | 50 // MockTabModalConfirmDialogDelegate::Delegate: |
| 49 virtual void OnAccepted() OVERRIDE; | 51 virtual void OnAccepted() OVERRIDE; |
| 50 virtual void OnCanceled() OVERRIDE; | 52 virtual void OnCanceled() OVERRIDE; |
| 53 virtual void OnClosed() OVERRIDE; |
| 51 | 54 |
| 52 protected: | 55 protected: |
| 53 // Owned by |dialog_|. | 56 // Owned by |dialog_|. |
| 54 MockTabModalConfirmDialogDelegate* delegate_; | 57 MockTabModalConfirmDialogDelegate* delegate_; |
| 55 | 58 |
| 56 // Deletes itself. | 59 // Deletes itself. |
| 57 TabModalConfirmDialog* dialog_; | 60 TabModalConfirmDialog* dialog_; |
| 58 | 61 |
| 59 int accepted_count_; | 62 int accepted_count_; |
| 60 int canceled_count_; | 63 int canceled_count_; |
| 64 int closed_count_; |
| 61 | 65 |
| 62 private: | 66 private: |
| 63 DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogTest); | 67 DISALLOW_COPY_AND_ASSIGN(TabModalConfirmDialogTest); |
| 64 }; | 68 }; |
| 65 | 69 |
| 66 #endif // CHROME_BROWSER_UI_TAB_MODAL_CONFIRM_DIALOG_BROWSERTEST_H_ | 70 #endif // CHROME_BROWSER_UI_TAB_MODAL_CONFIRM_DIALOG_BROWSERTEST_H_ |
| OLD | NEW |