From b2aa333c7b9af41a0aa0122d9d976a4dee2be6ba Mon Sep 17 00:00:00 2001 From: "Daniel_Burrows@alumni.brown.edu" Date: Sat, 3 Jul 2010 18:48:03 -0700 Subject: Move the throttle object to src/generic/util. --- configure.ac | 1 + src/cmdline/Makefile.am | 2 - src/cmdline/SConscript | 2 - src/cmdline/cmdline_progress_throttle.cc | 123 -------------------------- src/cmdline/cmdline_progress_throttle.h | 52 ----------- src/cmdline/cmdline_search.cc | 11 +-- src/cmdline/cmdline_search_progress.cc | 10 ++- src/cmdline/cmdline_search_progress.h | 9 +- src/cmdline/cmdline_versions.cc | 11 +-- src/cmdline/mocks/cmdline_progress_throttle.h | 47 ---------- src/generic/util/Makefile.am | 4 + src/generic/util/SConscript | 4 + src/generic/util/mocks/Makefile.am | 1 + src/generic/util/mocks/SConscript | 3 + src/generic/util/mocks/throttle.h | 47 ++++++++++ src/generic/util/throttle.cc | 123 ++++++++++++++++++++++++++ src/generic/util/throttle.h | 59 ++++++++++++ tests/SConscript | 2 +- tests/test_cmdline_search_progress.cc | 24 ++--- 19 files changed, 279 insertions(+), 256 deletions(-) delete mode 100644 src/cmdline/cmdline_progress_throttle.cc delete mode 100644 src/cmdline/cmdline_progress_throttle.h delete mode 100644 src/cmdline/mocks/cmdline_progress_throttle.h create mode 100644 src/generic/util/mocks/Makefile.am create mode 100644 src/generic/util/mocks/SConscript create mode 100644 src/generic/util/mocks/throttle.h create mode 100644 src/generic/util/throttle.cc create mode 100644 src/generic/util/throttle.h diff --git a/configure.ac b/configure.ac index a2910189..17908562 100644 --- a/configure.ac +++ b/configure.ac @@ -831,6 +831,7 @@ AC_CONFIG_FILES([ src/generic/apt/matching/Makefile src/generic/problemresolver/Makefile src/generic/util/Makefile + src/generic/util/mocks/Makefile src/generic/views/Makefile src/generic/views/mocks/Makefile src/mine/Makefile diff --git a/src/cmdline/Makefile.am b/src/cmdline/Makefile.am index 2f4a6966..4e5ca07b 100644 --- a/src/cmdline/Makefile.am +++ b/src/cmdline/Makefile.am @@ -34,8 +34,6 @@ libcmdline_a_SOURCES=\ cmdline_progress.h \ cmdline_progress_display.cc \ cmdline_progress_display.h \ - cmdline_progress_throttle.cc \ - cmdline_progress_throttle.h \ cmdline_prompt.cc \ cmdline_prompt.h \ cmdline_resolver.cc \ diff --git a/src/cmdline/SConscript b/src/cmdline/SConscript index 92db69d3..b87f9f79 100644 --- a/src/cmdline/SConscript +++ b/src/cmdline/SConscript @@ -28,8 +28,6 @@ src_filenames = [ 'cmdline_progress.h', 'cmdline_progress_display.cc', 'cmdline_progress_display.h', - 'cmdline_progress_throttle.cc', - 'cmdline_progress_throttle.h', 'cmdline_prompt.cc', 'cmdline_prompt.h', 'cmdline_resolver.cc', diff --git a/src/cmdline/cmdline_progress_throttle.cc b/src/cmdline/cmdline_progress_throttle.cc deleted file mode 100644 index 9773e4ed..00000000 --- a/src/cmdline/cmdline_progress_throttle.cc +++ /dev/null @@ -1,123 +0,0 @@ -/** \file cmdline_progress_throttle.cc */ // -*-c++-*- - -#include "cmdline_progress_throttle.h" - -// Local includes: -#include - -// System includes: -#include -#include - -#include - -#include -#include - -using aptitude::Loggers; -using boost::make_shared; -using boost::optional; -using boost::shared_ptr; -using logging::LoggerPtr; - -namespace aptitude -{ - namespace cmdline - { - namespace - { - class progress_throttle_impl : public progress_throttle - { - boost::optional last_update; - - logging::LoggerPtr logger; - - // Used to ensure that we only warn once about gettimeofday() - // failing. - bool wrote_time_error; - - static const double update_interval = 0.7; - - void write_time_error(int errnum); - - public: - progress_throttle_impl(); - - /** \return \b true if the progress display should be updated. */ - bool update_required(); - - /** \brief Reset the timer that controls when the display is - * updated. - */ - void reset_timer(); - }; - - const double progress_throttle_impl::update_interval; - - void progress_throttle_impl::write_time_error(int errnum) - { - if(!wrote_time_error) - { - LOG_ERROR(logger, - "gettimeofday() failed: " << - sstrerror(errnum)); - wrote_time_error = true; - } - } - - progress_throttle_impl::progress_throttle_impl() - : logger(Loggers::getAptitudeCmdlineThrottle()), - wrote_time_error(false) - { - } - - bool progress_throttle_impl::update_required() - { - if(!last_update) - return true; - else - { - // Time checking code shamelessly stolen from apt, since - // we know theirs works. - struct timeval now; - if(gettimeofday(&now, 0) != 0) - { - write_time_error(errno); - return false; - } - else - { - const struct timeval &last_update_time = *last_update; - double diff = - now.tv_sec - last_update_time.tv_sec + - (now.tv_usec - last_update_time.tv_usec)/1000000.0; - - bool rval = diff >= update_interval; - - return rval; - } - } - } - - void progress_throttle_impl::reset_timer() - { - LOG_TRACE(logger, "Resetting the update timer."); - - struct timeval now; - if(gettimeofday(&now, 0) != 0) - write_time_error(errno); - else - last_update = now; - } - } - - progress_throttle::~progress_throttle() - { - } - - shared_ptr create_progress_throttle() - { - return make_shared(); - } - } -} diff --git a/src/cmdline/cmdline_progress_throttle.h b/src/cmdline/cmdline_progress_throttle.h deleted file mode 100644 index fbbb9f22..00000000 --- a/src/cmdline/cmdline_progress_throttle.h +++ /dev/null @@ -1,52 +0,0 @@ -/** \file cmdline_progress_throttle.h */ // -*-c++-*- - -// Copyright (C) 2010 Daniel Burrows -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; see the file COPYING. If not, write to -// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -// Boston, MA 02111-1307, USA. - -#ifndef CMDLINE_PROGRESS_THROTTLE_H -#define CMDLINE_PROGRESS_THROTTLE_H - -// System includes: -#include - -namespace aptitude -{ - namespace cmdline - { - /** \brief Used to check whether enough time has passed that a - * progress display should be updated. - */ - class progress_throttle - { - public: - virtual ~progress_throttle() = 0; - - /** \return \b true if the progress display should be updated. */ - virtual bool update_required() = 0; - - /** \brief Reset the timer that controls when the display is - * updated. - */ - virtual void reset_timer() = 0; - }; - - /** \brief Create a progress_throttle object. */ - boost::shared_ptr create_progress_throttle(); - } -} - -#endif // CMDLINE_PROGRESS_THROTTLE_H diff --git a/src/cmdline/cmdline_search.cc b/src/cmdline/cmdline_search.cc index 0104ae20..49349340 100644 --- a/src/cmdline/cmdline_search.cc +++ b/src/cmdline/cmdline_search.cc @@ -24,7 +24,6 @@ #include "cmdline_common.h" #include "cmdline_progress_display.h" -#include "cmdline_progress_throttle.h" #include "cmdline_search_progress.h" #include "cmdline_util.h" #include "terminal.h" @@ -43,6 +42,7 @@ #include #include #include +#include #include #include @@ -63,18 +63,19 @@ using namespace std; namespace cw = cwidget; using aptitude::Loggers; -using aptitude::cmdline::create_progress_throttle; +using aptitude::cmdline::create_search_progress; using aptitude::cmdline::create_terminal; using aptitude::cmdline::create_terminal_locale; using aptitude::cmdline::make_text_progress; -using aptitude::cmdline::progress_throttle; using aptitude::cmdline::terminal; using aptitude::cmdline::terminal_locale; using aptitude::matching::serialize_pattern; +using aptitude::util::create_throttle; using aptitude::util::progress_info; using aptitude::util::progress_type_bar; using aptitude::util::progress_type_none; using aptitude::util::progress_type_pulse; +using aptitude::util::throttle; using aptitude::views::progress; using boost::format; using boost::shared_ptr; @@ -100,8 +101,8 @@ namespace const shared_ptr search_progress_display = create_progress_display(term, term_locale); - const shared_ptr search_progress_throttle = - create_progress_throttle(); + const shared_ptr search_progress_throttle = + create_throttle(); results_list output; ref_ptr search_info(search_cache::create()); diff --git a/src/cmdline/cmdline_search_progress.cc b/src/cmdline/cmdline_search_progress.cc index 5f5eb3e6..e7fc5da0 100644 --- a/src/cmdline/cmdline_search_progress.cc +++ b/src/cmdline/cmdline_search_progress.cc @@ -22,9 +22,9 @@ #include "cmdline_search_progress.h" #include "cmdline_progress_display.h" -#include "cmdline_progress_throttle.h" #include +#include #include @@ -42,6 +42,8 @@ using boost::make_shared; using boost::shared_ptr; using cwidget::util::ref_ptr; +namespace util = aptitude::util; + namespace aptitude { namespace cmdline @@ -51,12 +53,12 @@ namespace aptitude class search_progress : public views::progress { shared_ptr display; - shared_ptr throttle; + shared_ptr throttle; std::string pattern; public: search_progress(const shared_ptr &_display, - const shared_ptr &_throttle, + const shared_ptr &_throttle, const std::string &_pattern) : display(_display), throttle(_throttle), @@ -112,7 +114,7 @@ namespace aptitude shared_ptr create_search_progress(const std::string &pattern, const shared_ptr &display, - const shared_ptr &throttle) + const shared_ptr &throttle) { return make_shared(display, throttle, diff --git a/src/cmdline/cmdline_search_progress.h b/src/cmdline/cmdline_search_progress.h index 9cf6ef96..3131d04d 100644 --- a/src/cmdline/cmdline_search_progress.h +++ b/src/cmdline/cmdline_search_progress.h @@ -29,10 +29,13 @@ namespace aptitude class progress; } - namespace cmdline + namespace util { - class progress_throttle; + class throttle; + } + namespace cmdline + { /** \brief Create a progress-display object specialized for * showing the progress of a search. * @@ -47,7 +50,7 @@ namespace aptitude boost::shared_ptr create_search_progress(const std::string &pattern, const boost::shared_ptr &display, - const boost::shared_ptr &throttle); + const boost::shared_ptr &throttle); } } diff --git a/src/cmdline/cmdline_versions.cc b/src/cmdline/cmdline_versions.cc index 38ff54b9..46351328 100644 --- a/src/cmdline/cmdline_versions.cc +++ b/src/cmdline/cmdline_versions.cc @@ -22,7 +22,6 @@ #include "cmdline_versions.h" #include "cmdline_progress_display.h" -#include "cmdline_progress_throttle.h" #include "cmdline_search_progress.h" #include "cmdline_util.h" #include "terminal.h" @@ -35,6 +34,7 @@ #include #include #include +#include #include @@ -57,19 +57,20 @@ namespace cw = cwidget; namespace m = aptitude::matching; using aptitude::cmdline::create_progress_display; -using aptitude::cmdline::create_progress_throttle; +using aptitude::cmdline::create_search_progress; using aptitude::cmdline::create_terminal; using aptitude::cmdline::create_terminal_locale; using aptitude::cmdline::lessthan_1st; using aptitude::cmdline::package_results_lt; -using aptitude::cmdline::progress_throttle; using aptitude::cmdline::search_result_column_parameters; using aptitude::cmdline::terminal; using aptitude::cmdline::terminal_locale; using aptitude::cmdline::version_results_eq; using aptitude::cmdline::version_results_lt; using aptitude::matching::serialize_pattern; +using aptitude::util::create_throttle; using aptitude::util::progress_info; +using aptitude::util::throttle; using aptitude::views::progress; using boost::shared_ptr; @@ -257,8 +258,8 @@ namespace const shared_ptr search_progress_display = create_progress_display(term, term_locale); - const shared_ptr search_progress_throttle = - create_progress_throttle(); + const shared_ptr search_progress_throttle = + create_throttle(); results_list output; cw::util::ref_ptr search_info(m::search_cache::create()); diff --git a/src/cmdline/mocks/cmdline_progress_throttle.h b/src/cmdline/mocks/cmdline_progress_throttle.h deleted file mode 100644 index 19c9d1a5..00000000 --- a/src/cmdline/mocks/cmdline_progress_throttle.h +++ /dev/null @@ -1,47 +0,0 @@ -/** \file cmdline_progress_throttle.h */ // -*-c++-*- - - -// Copyright (C) 2010 Daniel Burrows -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License as -// published by the Free Software Foundation; either version 2 of the -// License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; see the file COPYING. If not, write to -// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -// Boston, MA 02111-1307, USA. - -#ifndef CMDLINE_PROGRESS_THROTTLE -#define CMDLINE_PROGRESS_THROTTLE - -// Local includes: -#include - -// System includes: -#include - -namespace aptitude -{ - namespace cmdline - { - namespace mocks - { - /** \brief Mock implementation of cmdline::progress_throttle. */ - class progress_throttle : public aptitude::cmdline::progress_throttle - { - public: - MOCK_METHOD0(update_required, bool()); - MOCK_METHOD0(reset_timer, void()); - }; - } - } -} - -#endif // CMDLINE_PROGRESS_THROTTLE diff --git a/src/generic/util/Makefile.am b/src/generic/util/Makefile.am index c754e805..6652afc5 100644 --- a/src/generic/util/Makefile.am +++ b/src/generic/util/Makefile.am @@ -4,6 +4,8 @@ localedir = $(datadir)/locale INCLUDES = -I$(top_builddir) -I$(srcdir) -I$(top_srcdir) -I$(top_srcdir)/src DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ +SUBDIRS = mocks + noinst_LIBRARIES = libgeneric-util.a libgeneric_util_a_SOURCES = \ compare3.h \ @@ -40,6 +42,8 @@ libgeneric_util_a_SOURCES = \ sqlite.h \ temp.cc \ temp.h \ + throttle.cc \ + throttle.h \ undo.cc \ undo.h \ util.cc \ diff --git a/src/generic/util/SConscript b/src/generic/util/SConscript index fe9eeaf5..0615eac0 100644 --- a/src/generic/util/SConscript +++ b/src/generic/util/SConscript @@ -34,6 +34,8 @@ srcs = map(File, [ 'sqlite.h', 'temp.cc', 'temp.h', + 'throttle.cc', + 'throttle.h', 'undo.cc', 'undo.h', 'util.cc', @@ -42,4 +44,6 @@ srcs = map(File, [ programs_env.Dist('Makefile.am', 'SConscript') +SConscript(dirs = [ 'mocks' ]) + Return('srcs') diff --git a/src/generic/util/mocks/Makefile.am b/src/generic/util/mocks/Makefile.am new file mode 100644 index 00000000..6b88c48d --- /dev/null +++ b/src/generic/util/mocks/Makefile.am @@ -0,0 +1 @@ +EXTRA_DIST = throttle.h \ No newline at end of file diff --git a/src/generic/util/mocks/SConscript b/src/generic/util/mocks/SConscript new file mode 100644 index 00000000..025e0f15 --- /dev/null +++ b/src/generic/util/mocks/SConscript @@ -0,0 +1,3 @@ +Import('programs_env') + +programs_env.Dist('throttle.h') diff --git a/src/generic/util/mocks/throttle.h b/src/generic/util/mocks/throttle.h new file mode 100644 index 00000000..0e852f6e --- /dev/null +++ b/src/generic/util/mocks/throttle.h @@ -0,0 +1,47 @@ +/** \file throttle.h */ // -*-c++-*- + + +// Copyright (C) 2010 Daniel Burrows +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#ifndef APTITUDE_UTIL_MOCKS_THROTTLE_H +#define APTITUDE_UTIL_MOCKS_THROTTLE_H + +// Local includes: +#include + +// System includes: +#include + +namespace aptitude +{ + namespace util + { + namespace mocks + { + /** \brief Mock implementation of aptitude::util::throttle. */ + class throttle : public aptitude::util::throttle + { + public: + MOCK_METHOD0(update_required, bool()); + MOCK_METHOD0(reset_timer, void()); + }; + } + } +} + +#endif // APTITUDE_UTIL_MOCKS_THROTTLE_H diff --git a/src/generic/util/throttle.cc b/src/generic/util/throttle.cc new file mode 100644 index 00000000..9697df36 --- /dev/null +++ b/src/generic/util/throttle.cc @@ -0,0 +1,123 @@ +/** \file throttle.cc */ // -*-c++-*- + +#include "throttle.h" + +// Local includes: +#include + +// System includes: +#include +#include + +#include + +#include +#include + +using aptitude::Loggers; +using boost::make_shared; +using boost::optional; +using boost::shared_ptr; +using logging::LoggerPtr; + +namespace aptitude +{ + namespace util + { + namespace + { + class throttle_impl : public throttle + { + boost::optional last_update; + + logging::LoggerPtr logger; + + // Used to ensure that we only warn once about gettimeofday() + // failing. + bool wrote_time_error; + + static const double update_interval = 0.7; + + void write_time_error(int errnum); + + public: + throttle_impl(); + + /** \return \b true if the timer has expired. */ + bool update_required(); + + /** \brief Reset the timer that controls when the display is + * updated. + */ + void reset_timer(); + }; + + const double throttle_impl::update_interval; + + void throttle_impl::write_time_error(int errnum) + { + if(!wrote_time_error) + { + LOG_ERROR(logger, + "gettimeofday() failed: " << + sstrerror(errnum)); + wrote_time_error = true; + } + } + + throttle_impl::throttle_impl() + : logger(Loggers::getAptitudeCmdlineThrottle()), + wrote_time_error(false) + { + } + + bool throttle_impl::update_required() + { + if(!last_update) + return true; + else + { + // Time checking code shamelessly stolen from apt, since + // we know theirs works. + struct timeval now; + if(gettimeofday(&now, 0) != 0) + { + write_time_error(errno); + return false; + } + else + { + const struct timeval &last_update_time = *last_update; + double diff = + now.tv_sec - last_update_time.tv_sec + + (now.tv_usec - last_update_time.tv_usec)/1000000.0; + + bool rval = diff >= update_interval; + + return rval; + } + } + } + + void throttle_impl::reset_timer() + { + LOG_TRACE(logger, "Resetting the update timer."); + + struct timeval now; + if(gettimeofday(&now, 0) != 0) + write_time_error(errno); + else + last_update = now; + } + } + + throttle::~throttle() + { + } + + shared_ptr create_throttle() + { + return make_shared(); + } + } +} diff --git a/src/generic/util/throttle.h b/src/generic/util/throttle.h new file mode 100644 index 00000000..5535b8a2 --- /dev/null +++ b/src/generic/util/throttle.h @@ -0,0 +1,59 @@ +/** \file throttle.h */ // -*-c++-*- + +// Copyright (C) 2010 Daniel Burrows +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License as +// published by the Free Software Foundation; either version 2 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; see the file COPYING. If not, write to +// the Free Software Foundation, Inc., 59 Temple Place - Suite 330, +// Boston, MA 02111-1307, USA. + +#ifndef APTITUDE_UTIL_THROTTLE_H +#define APTITUDE_UTIL_THROTTLE_H + +// System includes: +#include + +namespace aptitude +{ + namespace util + { + /** \brief Used to ensure that an expensive operation (such as + * updating a progress indicator) doesn't run too often. + * + * To test code that uses this class, use the mock that's + * available in mocks/. + */ + class throttle + { + public: + virtual ~throttle() = 0; + + /** \return \b true if the timer has expired. */ + virtual bool update_required() = 0; + + /** \brief Reset the timer that controls when the display is + * updated. + */ + virtual void reset_timer() = 0; + }; + + /** \brief Create a throttle object. + * + * \todo This should take an argument giving the update interval + * in seconds. + */ + boost::shared_ptr create_throttle(); + } +} + +#endif // APTITUDE_UTIL_THROTTLE_H diff --git a/tests/SConscript b/tests/SConscript index 4744196b..06fd8b54 100644 --- a/tests/SConscript +++ b/tests/SConscript @@ -104,7 +104,6 @@ gtest_test_sources = [ gtest_test_extra_deps = [ '../src/cmdline/cmdline_download_progress_display.o', '../src/cmdline/cmdline_progress_display.o', - '../src/cmdline/cmdline_progress_throttle.o', '../src/cmdline/cmdline_search_progress.o', '../src/cmdline/mocks/teletype.o', '../src/cmdline/mocks/terminal.o', @@ -113,6 +112,7 @@ gtest_test_extra_deps = [ '../src/generic/apt/globals.o', '../src/generic/util/logging.o', '../src/generic/util/progress_info.o', + '../src/generic/util/throttle.o', '../src/generic/util/util.o', '../src/generic/views/download_progress.o', '../src/generic/views/progress.o', diff --git a/tests/test_cmdline_search_progress.cc b/tests/test_cmdline_search_progress.cc index 0679033e..e245e690 100644 --- a/tests/test_cmdline_search_progress.cc +++ b/tests/test_cmdline_search_progress.cc @@ -22,9 +22,9 @@ // Local includes: #include -#include #include +#include #include // System includes: @@ -48,7 +48,7 @@ using testing::_; namespace mocks { - using namespace aptitude::cmdline::mocks; + using namespace aptitude::util::mocks; using namespace aptitude::views::mocks; } @@ -59,7 +59,7 @@ namespace struct CmdlineSearchProgressTest : public Test { const shared_ptr progress; - const shared_ptr progress_throttle; + const shared_ptr throttle; /** \brief The search pattern string used to create the search * progress object. @@ -69,11 +69,11 @@ namespace CmdlineSearchProgressTest() : progress(make_shared()), - progress_throttle(make_shared()), + throttle(make_shared()), search_pattern("?name(aptitude)"), search_progress(create_search_progress(search_pattern, progress, - progress_throttle)) + throttle)) { } @@ -95,19 +95,19 @@ namespace void never_throttle() { - EXPECT_CALL(*progress_throttle, update_required()) + EXPECT_CALL(*throttle, update_required()) .WillRepeatedly(Return(true)); - EXPECT_CALL(*progress_throttle, reset_timer()) + EXPECT_CALL(*throttle, reset_timer()) .Times(AnyNumber()); } void always_throttle() { - EXPECT_CALL(*progress_throttle, update_required()) + EXPECT_CALL(*throttle, update_required()) .WillRepeatedly(Return(false)); // No call to reset_timer() expected since it's throttled -- // calling it would, in fact, be wrong. - EXPECT_CALL(*progress_throttle, reset_timer()) + EXPECT_CALL(*throttle, reset_timer()) .Times(0); } }; @@ -159,7 +159,7 @@ TEST_F(CmdlineSearchProgressTest, ThrottledProgressNone) // Check that a second set_progress() call goes through, since // throttling is no longer enabled: - Mock::VerifyAndClearExpectations(progress_throttle.get()); + Mock::VerifyAndClearExpectations(throttle.get()); Mock::VerifyAndClearExpectations(progress.get()); never_throttle(); @@ -184,7 +184,7 @@ TEST_F(CmdlineSearchProgressTest, ThrottledProgressPulse) // Check that a second set_progress() call goes through, since // throttling is no longer enabled: - Mock::VerifyAndClearExpectations(progress_throttle.get()); + Mock::VerifyAndClearExpectations(throttle.get()); Mock::VerifyAndClearExpectations(progress.get()); never_throttle(); @@ -211,7 +211,7 @@ TEST_F(CmdlineSearchProgressTest, ThrottledProgressBar) // Check that a second set_progress() call goes through, since // throttling is no longer enabled: - Mock::VerifyAndClearExpectations(progress_throttle.get()); + Mock::VerifyAndClearExpectations(throttle.get()); Mock::VerifyAndClearExpectations(progress.get()); never_throttle(); -- cgit v1.2.3