1 // Copyright 2013 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_HELPER_
6 #define MEDIA_CAST_TEST_UTILITY_INPUT_HELPER_
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.
20 InputBuilder(const std::string& title,
21 const std::string& default_value,
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
32 std::string GetStringInput() const;
33 int GetIntInput() const;
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.
42 const int high_range_;
49 #endif // MEDIA_CAST_TEST_UTILITY_INPUT_HELPER_