Revert "Omit calls to set composing region when pasting image."
[chromium-blink-merge.git] / media / cast / test / utility / input_builder.h
blob4eb4ae52839d812300af36809d58ca1901183cc6
1 // Copyright 2014 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.
5 #ifndef MEDIA_CAST_TEST_UTILITY_INPUT_BUILDER_
6 #define MEDIA_CAST_TEST_UTILITY_INPUT_BUILDER_
8 #include <string>
10 namespace media {
11 namespace cast {
12 namespace test {
14 // This class handles general user input to the application. The user will be
15 // displayed with the title string and be given a default value. When forced
16 // a range, the input values should be within low_range to high_range.
17 // Setting low and high to INT_MIN/INT_MAX is equivalent to not setting a range.
18 class InputBuilder {
19 public:
20 InputBuilder(const std::string& title,
21 const std::string& default_value,
22 int low_range,
23 int high_range);
24 virtual ~InputBuilder();
26 // Ask the user for input, reads input from the input source and returns
27 // the answer. This method will keep asking the user until a correct answer
28 // is returned and is thereby guaranteed to return a response that is
29 // acceptable within the predefined range.
30 // Input will be returned in either string or int format, base on the function
31 // called.
32 std::string GetStringInput() const;
33 int GetIntInput() const;
35 private:
36 bool ValidateInput(const std::string input) const;
38 const std::string title_;
39 const std::string default_value_;
40 // Low and high range values for input validation.
41 const int low_range_;
42 const int high_range_;
45 } // namespace test
46 } // namespace cast
47 } // namespace media
49 #endif // MEDIA_CAST_TEST_UTILITY_INPUT_BUILDER_