1# Copyright 2014 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. 4 5from pylib.gtest import gtest_test_instance 6from pylib.instrumentation import instrumentation_test_instance 7from pylib.uirobot import uirobot_test_instance 8from pylib.utils import isolator 9 10 11def CreateTestInstance(args, error_func): 12 13 if args.command == 'gtest': 14 return gtest_test_instance.GtestTestInstance( 15 args, isolator.Isolator(), error_func) 16 elif args.command == 'instrumentation': 17 return instrumentation_test_instance.InstrumentationTestInstance( 18 args, isolator.Isolator(), error_func) 19 elif args.command == 'uirobot': 20 return uirobot_test_instance.UirobotTestInstance(args, error_func) 21 22 error_func('Unable to create %s test instance.' % args.command) 23