Refactor nag functionality in to NagTimer class.

Add default 30 second nag timer to gclient subprocesses.

BUG=227537

Review URL: https://chromiumcodereview.appspot.com/14826003

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@198207 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/tests/gclient_scm_test.py b/tests/gclient_scm_test.py
index f9a29bb..3640a3e 100755
--- a/tests/gclient_scm_test.py
+++ b/tests/gclient_scm_test.py
@@ -107,6 +107,8 @@
         'RunCommand',
         'cleanup',
         'diff',
+        'nag_max',
+        'nag_timer',
         'pack',
         'relpath',
         'revert',
@@ -496,6 +498,8 @@
     gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(
         ['svn', 'checkout', '--depth', 'empty', self.url, self.base_path],
         always=True,
+        nag_max=3,
+        nag_timer=30,
         cwd=self.root_dir)
     gclient_scm.scm.SVN.RunAndGetFileList(
         options.verbose,
@@ -530,7 +534,7 @@
     files_list = self.mox.CreateMockAnything()
     gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(
         ['svn', 'export', join(self.url, 'DEPS'), join(self.base_path, 'DEPS')],
-        always=True, cwd=self.root_dir)
+        nag_timer=30, nag_max=3, always=True, cwd=self.root_dir)
 
     self.mox.ReplayAll()
     scm = self._scm_wrapper(url=self.url, root_dir=self.root_dir,
@@ -563,6 +567,8 @@
     gclient_scm.gclient_utils.CheckCallAndFilterAndHeader(
         ['svn', 'checkout', '--depth', 'empty', self.url, self.base_path],
         always=True,
+        nag_max=3,
+        nag_timer=30,
         cwd=self.root_dir)
     gclient_scm.scm.SVN.RunAndGetFileList(
         options.verbose,
@@ -787,6 +793,8 @@
         'RunCommand',
         'cleanup',
         'diff',
+        'nag_max',
+        'nag_timer',
         'pack',
         'UpdateSubmoduleConfig',
         'relpath',
diff --git a/tests/subprocess2_test.py b/tests/subprocess2_test.py
index 62034ad..dc020f2 100755
--- a/tests/subprocess2_test.py
+++ b/tests/subprocess2_test.py
@@ -78,7 +78,7 @@
         results['args'] = args
       @staticmethod
       # pylint: disable=W0622
-      def communicate(input=None, timeout=None, nag_timer=None):
+      def communicate(input=None, timeout=None, nag_max=None, nag_timer=None):
         return None, None
     self.mock(subprocess2, 'Popen', fake_Popen)
     return results