OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 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 #ifndef IOS_WEB_PUBLIC_TEST_FAKES_TEST_WEB_STATE_DELEGATE_H_ |
| 6 #define IOS_WEB_PUBLIC_TEST_FAKES_TEST_WEB_STATE_DELEGATE_H_ |
| 7 |
| 8 #include "ios/web/public/web_state/web_state_delegate.h" |
| 9 #import "ios/web/public/test/fakes/test_java_script_dialog_presenter.h" |
| 10 |
| 11 namespace web { |
| 12 |
| 13 // Fake WebStateDelegate used for testing purposes. |
| 14 class TestWebStateDelegate : public WebStateDelegate { |
| 15 public: |
| 16 // WebStateDelegate overrides: |
| 17 JavaScriptDialogPresenter* GetJavaScriptDialogPresenter(WebState*) override; |
| 18 void LoadProgressChanged(WebState* source, double progress) override; |
| 19 bool HandleContextMenu(WebState* source, |
| 20 const ContextMenuParams& params) override; |
| 21 |
| 22 TestJavaScriptDialogPresenter* GetTestJavaScriptDialogPresenter(); |
| 23 |
| 24 // True if the WebStateDelegate LoadProgressChanged method has been called. |
| 25 bool load_progress_changed_called() const { |
| 26 return load_progress_changed_called_; |
| 27 } |
| 28 |
| 29 // True if the WebStateDelegate HandleContextMenu method has been called. |
| 30 bool handle_context_menu_called() const { |
| 31 return handle_context_menu_called_; |
| 32 } |
| 33 |
| 34 // True if the WebStateDelegate GetJavaScriptDialogPresenter method has been |
| 35 // called. |
| 36 bool get_java_script_dialog_presenter_called() const { |
| 37 return get_java_script_dialog_presenter_called_; |
| 38 } |
| 39 |
| 40 private: |
| 41 bool load_progress_changed_called_ = false; |
| 42 bool handle_context_menu_called_ = false; |
| 43 bool get_java_script_dialog_presenter_called_ = false; |
| 44 TestJavaScriptDialogPresenter java_script_dialog_presenter_; |
| 45 }; |
| 46 |
| 47 } // namespace web |
| 48 |
| 49 #endif // IOS_WEB_PUBLIC_TEST_FAKES_TEST_WEB_STATE_DELEGATE_H_ |
OLD | NEW |