Home | History | Annotate | Download | only in chromeos-dbus-bindings
      1 // Copyright 2015 The Chromium OS 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 CHROMEOS_DBUS_BINDINGS_TEST_UTILS_H_
      6 #define CHROMEOS_DBUS_BINDINGS_TEST_UTILS_H_
      7 
      8 #include <string>
      9 
     10 #include <base/location.h>
     11 
     12 namespace chromeos_dbus_bindings {
     13 namespace test_utils {
     14 
     15 // Helper macro to call ExpectTextContained().
     16 #define EXPECT_TEXT_CONTAINED(expected, actual) \
     17   ExpectTextContained(FROM_HERE, expected, #expected, actual, #actual)
     18 
     19 // Checks that the text |actual_str| is contained in the text |expected_str| and
     20 // fails the current test if not. If the |actual_str| text is not contained, a
     21 // meaningful line diff between |actual_str| and |expected_str| is displayed in
     22 // stderr. Use this function instead of EXPECT_EQ() when the compared values are
     23 // long texts.
     24 void ExpectTextContained(const tracked_objects::Location& from_here,
     25                          const std::string& expected_str,
     26                          const std::string& expected_expr,
     27                          const std::string& actual_str,
     28                          const std::string& actual_expr);
     29 
     30 }  // namespace test_utils
     31 }  // namespace chromeos_dbus_bindings
     32 
     33 #endif  // CHROMEOS_DBUS_BINDINGS_TEST_UTILS_H_
     34