Timeout devicelab tasks on 10 mins.

The longest task(microbenchmarks) takes a total of 6mins to execute.
This will ensure that we fail fast and we don't waste 45 mins waiting
for the task timeout to trigger. More importantly test timeouts are
actual errors in the test and this will prevent counting them as infra
failures.

Change-Id: I9f6eeca520c158fb766553437b1f95dfeb63d080
Bug: https://github.com/flutter/flutter/issues/79993
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/12160
Reviewed-by: Keyong Han <keyonghan@google.com>
Commit-Queue: Godofredo Contreras <godofredoc@google.com>
diff --git a/recipes/devicelab/devicelab_drone.expected/basic.json b/recipes/devicelab/devicelab_drone.expected/basic.json
index c4460d3..2a47493 100644
--- a/recipes/devicelab/devicelab_drone.expected/basic.json
+++ b/recipes/devicelab/devicelab_drone.expected/basic.json
@@ -300,7 +300,7 @@
       ]
     },
     "name": "run abc",
-    "timeout": 3600,
+    "timeout": 600,
     "~followup_annotations": [
       "@@@STEP_LOG_LINE@stdout@@@@",
       "@@@STEP_LOG_END@stdout@@@",
diff --git a/recipes/devicelab/devicelab_drone.expected/no-task-name.json b/recipes/devicelab/devicelab_drone.expected/no-task-name.json
index 74f823d..794ef8a 100644
--- a/recipes/devicelab/devicelab_drone.expected/no-task-name.json
+++ b/recipes/devicelab/devicelab_drone.expected/no-task-name.json
@@ -7,7 +7,7 @@
       "The recipe has crashed at point 'Uncaught exception'!",
       "",
       "Traceback (most recent call last):",
-      "  File \"RECIPE_REPO[flutter]/recipes/devicelab/devicelab_drone.py\", line 32, in RunSteps",
+      "  File \"RECIPE_REPO[flutter]/recipes/devicelab/devicelab_drone.py\", line 35, in RunSteps",
       "    raise ValueError('A task_name property is required')",
       "ValueError: A task_name property is required"
     ]
diff --git a/recipes/devicelab/devicelab_drone.expected/post-submit.json b/recipes/devicelab/devicelab_drone.expected/post-submit.json
index ebf20f1..15c5f9a 100644
--- a/recipes/devicelab/devicelab_drone.expected/post-submit.json
+++ b/recipes/devicelab/devicelab_drone.expected/post-submit.json
@@ -299,7 +299,7 @@
       ]
     },
     "name": "run abc",
-    "timeout": 3600,
+    "timeout": 600,
     "~followup_annotations": [
       "@@@STEP_LOG_LINE@stdout@@@@",
       "@@@STEP_LOG_END@stdout@@@",
diff --git a/recipes/devicelab/devicelab_drone.expected/upload-metrics-mac.json b/recipes/devicelab/devicelab_drone.expected/upload-metrics-mac.json
index 17b4c09..7b302ea 100644
--- a/recipes/devicelab/devicelab_drone.expected/upload-metrics-mac.json
+++ b/recipes/devicelab/devicelab_drone.expected/upload-metrics-mac.json
@@ -325,7 +325,7 @@
       ]
     },
     "name": "run abc",
-    "timeout": 3600,
+    "timeout": 600,
     "~followup_annotations": [
       "@@@STEP_LOG_LINE@stdout@@@@",
       "@@@STEP_LOG_END@stdout@@@",
diff --git a/recipes/devicelab/devicelab_drone.expected/xcode-chromium-mac.json b/recipes/devicelab/devicelab_drone.expected/xcode-chromium-mac.json
index b831ea4b..eb7c304 100644
--- a/recipes/devicelab/devicelab_drone.expected/xcode-chromium-mac.json
+++ b/recipes/devicelab/devicelab_drone.expected/xcode-chromium-mac.json
@@ -325,7 +325,7 @@
       ]
     },
     "name": "run abc",
-    "timeout": 3600,
+    "timeout": 600,
     "~followup_annotations": [
       "@@@STEP_LOG_LINE@stdout@@@@",
       "@@@STEP_LOG_END@stdout@@@",
diff --git a/recipes/devicelab/devicelab_drone.expected/xcode-devicelab.json b/recipes/devicelab/devicelab_drone.expected/xcode-devicelab.json
index b831ea4b..eb7c304 100644
--- a/recipes/devicelab/devicelab_drone.expected/xcode-devicelab.json
+++ b/recipes/devicelab/devicelab_drone.expected/xcode-devicelab.json
@@ -325,7 +325,7 @@
       ]
     },
     "name": "run abc",
-    "timeout": 3600,
+    "timeout": 600,
     "~followup_annotations": [
       "@@@STEP_LOG_LINE@stdout@@@@",
       "@@@STEP_LOG_END@stdout@@@",
diff --git a/recipes/devicelab/devicelab_drone.py b/recipes/devicelab/devicelab_drone.py
index b8b84b3..a230a9c 100644
--- a/recipes/devicelab/devicelab_drone.py
+++ b/recipes/devicelab/devicelab_drone.py
@@ -25,6 +25,9 @@
     'recipe_engine/swarming',
 ]
 
+# Ten minutes
+MAX_TIMEOUT_SECS = 10 * 60
+
 
 def RunSteps(api):
   task_name = api.properties.get("task_name")
@@ -83,7 +86,11 @@
         api.step('flutter doctor', ['flutter', 'doctor', '--verbose'])
         test_runner_command = ['dart', 'bin/run.dart']
         test_runner_command.extend(runner_params)
-        api.test_utils.run_test('run %s' % task_name, test_runner_command)
+        api.test_utils.run_test(
+            'run %s' % task_name,
+            test_runner_command,
+            timeout_secs=MAX_TIMEOUT_SECS
+        )
         api.logs_util.upload_logs(task_name)
         # This is to clean up leaked processes.
         api.os_utils.kill_processes()
@@ -106,7 +113,11 @@
     api.step('Set execute permission', ['chmod', '755', resource_name])
     test_runner_command = [resource_name]
     test_runner_command.extend(runner_params)
-    api.test_utils.run_test('run %s' % task_name, test_runner_command)
+    api.test_utils.run_test(
+        'run %s' % task_name,
+        test_runner_command,
+        timeout_secs=MAX_TIMEOUT_SECS
+    )
     api.logs_util.upload_logs(task_name)
     # This is to clean up leaked processes.
     api.os_utils.kill_processes()