| OLD | NEW |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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 CONTENT_PUBLIC_TEST_FIND_TEST_UTILS_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_FIND_TEST_UTILS_H_ |
| 6 #define CONTENT_PUBLIC_TEST_FIND_TEST_UTILS_H_ | 6 #define CONTENT_PUBLIC_TEST_FIND_TEST_UTILS_H_ |
| 7 | 7 |
| 8 #include "content/public/browser/web_contents_delegate.h" | 8 #include "content/public/browser/web_contents_delegate.h" |
| 9 #include "content/public/test/test_utils.h" | 9 #include "content/public/test/test_utils.h" |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 // The results of a find request. | 13 // The results of a find request. |
| 14 struct FindResults { | 14 struct FindResults { |
| 15 FindResults(int request_id, | 15 FindResults(int request_id, |
| 16 int number_of_matches, | 16 int number_of_matches, |
| 17 int active_match_ordinal); | 17 int active_match_ordinal, |
| 18 bool was_frame_removal); |
| 18 FindResults(); | 19 FindResults(); |
| 19 | 20 |
| 20 int request_id; | 21 int request_id; |
| 21 int number_of_matches; | 22 int number_of_matches; |
| 22 int active_match_ordinal; | 23 int active_match_ordinal; |
| 24 bool was_frame_removal; |
| 23 }; | 25 }; |
| 24 | 26 |
| 25 // This test delegate is used during find-in-page tests, in order to directly | 27 // This test delegate is used during find-in-page tests, in order to directly |
| 26 // access find replies going through the WebContentsDelegate. Tests functions in | 28 // access find replies going through the WebContentsDelegate. Tests functions in |
| 27 // this delegate allow for waiting on specific or all find replies to come in, | 29 // this delegate allow for waiting on specific or all find replies to come in, |
| 28 // and observe find results within them. | 30 // and observe find results within them. |
| 29 class FindTestWebContentsDelegate : public WebContentsDelegate { | 31 class FindTestWebContentsDelegate : public WebContentsDelegate { |
| 30 public: | 32 public: |
| 31 FindTestWebContentsDelegate(); | 33 FindTestWebContentsDelegate(); |
| 32 ~FindTestWebContentsDelegate() override; | 34 ~FindTestWebContentsDelegate() override; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 MATCH_RECTS | 84 MATCH_RECTS |
| 83 #endif | 85 #endif |
| 84 }; | 86 }; |
| 85 | 87 |
| 86 // WebContentsDelegate override. | 88 // WebContentsDelegate override. |
| 87 void FindReply(WebContents* web_contents, | 89 void FindReply(WebContents* web_contents, |
| 88 int request_id, | 90 int request_id, |
| 89 int number_of_matches, | 91 int number_of_matches, |
| 90 const gfx::Rect& selection_rect, | 92 const gfx::Rect& selection_rect, |
| 91 int active_match_ordinal, | 93 int active_match_ordinal, |
| 92 bool final_update) override; | 94 bool final_update, |
| 95 bool was_frame_removal) override; |
| 93 | 96 |
| 94 // Uses |message_loop_runner_| to wait for various things. | 97 // Uses |message_loop_runner_| to wait for various things. |
| 95 void WaitFor(WaitingFor wait_for); | 98 void WaitFor(WaitingFor wait_for); |
| 96 | 99 |
| 97 // Stop waiting for |waiting_for_|. | 100 // Stop waiting for |waiting_for_|. |
| 98 void StopWaiting(); | 101 void StopWaiting(); |
| 99 | 102 |
| 100 #if defined(OS_ANDROID) | 103 #if defined(OS_ANDROID) |
| 101 // WebContentsDelegate override. | 104 // WebContentsDelegate override. |
| 102 void FindMatchRectsReply(WebContents* web_contents, | 105 void FindMatchRectsReply(WebContents* web_contents, |
| (...skipping 30 matching lines...) Expand all Loading... |
| 133 WaitingFor waiting_for_; | 136 WaitingFor waiting_for_; |
| 134 | 137 |
| 135 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; | 138 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; |
| 136 | 139 |
| 137 DISALLOW_COPY_AND_ASSIGN(FindTestWebContentsDelegate); | 140 DISALLOW_COPY_AND_ASSIGN(FindTestWebContentsDelegate); |
| 138 }; | 141 }; |
| 139 | 142 |
| 140 } // namespace content | 143 } // namespace content |
| 141 | 144 |
| 142 #endif // CONTENT_PUBLIC_TEST_FIND_TEST_UTILS_H_a | 145 #endif // CONTENT_PUBLIC_TEST_FIND_TEST_UTILS_H_a |
| OLD | NEW |