Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: content/test/test_find_request_manager.h

Issue 1891773002: Implement the basic testing infrastructure for FindRequestManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added comment to describe TestFindRequestManager. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 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 CONTENT_TEST_TEST_FIND_REQUEST_MANAGER_H_
6 #define CONTENT_TEST_TEST_FIND_REQUEST_MANAGER_H_
7
8 #include "base/gtest_prod_util.h"
9 #include "content/browser/find_request_manager.h"
10 #include "content/public/test/test_utils.h"
11
12 namespace content {
13
14 class WebContentsImpl;
15
16 // TestFindRequestManager provides extra control and observation over
17 // FindRequestManager for the purposes of testing, without altering its
18 // behavior.
19 class TestFindRequestManager : public FindRequestManager {
nasko 2016/04/15 19:26:50 Do we really need to subclass the FindRequestManag
paulmeyer 2016/04/18 19:11:22 Now using WebContentsDelegate instead.
20 public:
21 explicit TestFindRequestManager(WebContentsImpl* web_contents);
22 ~TestFindRequestManager() override;
23
24 // FindRequestManager overrides for testing.
25 void Find(int request_id,
26 const base::string16& search_text,
27 const blink::WebFindOptions& options) override;
28
29 // Waits for the final reply to any pending find requests.
30 void WaitForFinalReply();
31
32 // The results of a find request.
33 struct FindResults {
34 int request_id;
35 int number_of_matches;
36 int active_match_ordinal;
37 };
38
39 // Returns the current find results.
40 FindResults GetFindResults();
41
42 private:
43 // FindRequestManager overrides for testing.
44 void NotifyFindReply(int request_id, bool final_update) const override;
45
46 // The ID of the last find request requested.
47 int last_request_id_;
48
49 // The ID of the last find request to finish (all replies received).
50 mutable int last_finished_request_id_;
51
52 // If waiting using |find_message_loop_runner_|, this is the ID of the find
53 // request being waited for.
54 int waiting_request_id_;
55
56 scoped_refptr<content::MessageLoopRunner> find_message_loop_runner_;
57 };
58
59 } // namespace content
60
61 #endif // CONTENT_TEST_TEST_FIND_REQUEST_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698