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 #import "chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h" | 4 #import "chrome/browser/ui/cocoa/autofill/autofill_dialog_cocoa.h" |
5 | 5 |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" | 9 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 dialog_type, | 37 dialog_type, |
38 base::Bind(MockCallback)), | 38 base::Bind(MockCallback)), |
39 metric_logger_(metric_logger) , | 39 metric_logger_(metric_logger) , |
40 runner_(runner) { | 40 runner_(runner) { |
41 DisableWallet(wallet::WalletClient::UNKNOWN_ERROR); | 41 DisableWallet(wallet::WalletClient::UNKNOWN_ERROR); |
42 } | 42 } |
43 | 43 |
44 virtual ~TestAutofillDialogController() {} | 44 virtual ~TestAutofillDialogController() {} |
45 | 45 |
46 virtual void ViewClosed() OVERRIDE { | 46 virtual void ViewClosed() OVERRIDE { |
47 DCHECK(runner_); | 47 DCHECK(runner_.get()); |
48 runner_->Quit(); | 48 runner_->Quit(); |
49 AutofillDialogControllerImpl::ViewClosed(); | 49 AutofillDialogControllerImpl::ViewClosed(); |
50 } | 50 } |
51 | 51 |
52 AutofillDialogCocoa* GetView() { | 52 AutofillDialogCocoa* GetView() { |
53 return static_cast<AutofillDialogCocoa*>( | 53 return static_cast<AutofillDialogCocoa*>( |
54 AutofillDialogControllerImpl::view()); | 54 AutofillDialogControllerImpl::view()); |
55 } | 55 } |
56 | 56 |
57 private: | 57 private: |
(...skipping 27 matching lines...) Expand all Loading... |
85 browser()->tab_strip_model()->GetActiveWebContents(), | 85 browser()->tab_strip_model()->GetActiveWebContents(), |
86 form_data, | 86 form_data, |
87 metric_logger_, | 87 metric_logger_, |
88 runner_, | 88 runner_, |
89 DIALOG_TYPE_REQUEST_AUTOCOMPLETE); | 89 DIALOG_TYPE_REQUEST_AUTOCOMPLETE); |
90 } | 90 } |
91 | 91 |
92 TestAutofillDialogController* controller() { return controller_; } | 92 TestAutofillDialogController* controller() { return controller_; } |
93 | 93 |
94 void RunMessageLoop() { | 94 void RunMessageLoop() { |
95 DCHECK(runner_); | 95 DCHECK(runner_.get()); |
96 runner_->Run(); | 96 runner_->Run(); |
97 } | 97 } |
98 | 98 |
99 private: | 99 private: |
100 // The controller owns itself. | 100 // The controller owns itself. |
101 TestAutofillDialogController* controller_; | 101 TestAutofillDialogController* controller_; |
102 | 102 |
103 // The following members must outlive the controller. | 103 // The following members must outlive the controller. |
104 AutofillMetrics metric_logger_; | 104 AutofillMetrics metric_logger_; |
105 scoped_refptr<content::MessageLoopRunner> runner_; | 105 scoped_refptr<content::MessageLoopRunner> runner_; |
106 | 106 |
107 DISALLOW_COPY_AND_ASSIGN(AutofillDialogCocoaBrowserTest); | 107 DISALLOW_COPY_AND_ASSIGN(AutofillDialogCocoaBrowserTest); |
108 }; | 108 }; |
109 | 109 |
110 IN_PROC_BROWSER_TEST_F(AutofillDialogCocoaBrowserTest, DisplayUI) { | 110 IN_PROC_BROWSER_TEST_F(AutofillDialogCocoaBrowserTest, DisplayUI) { |
111 controller()->Show(); | 111 controller()->Show(); |
112 controller()->OnCancel(); | 112 controller()->OnCancel(); |
113 controller()->Hide(); | 113 controller()->Hide(); |
114 | 114 |
115 RunMessageLoop(); | 115 RunMessageLoop(); |
116 } | 116 } |
117 | 117 |
118 } // namespace | 118 } // namespace |
119 | 119 |
120 } // namespace autofill | 120 } // namespace autofill |
OLD | NEW |