media/webrtc/trunk/testing/multiprocess_func_list.cc

Wed, 31 Dec 2014 13:27:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 13:27:57 +0100
branch
TOR_BUG_3246
changeset 6
8bccb770b82d
permissions
-rw-r--r--

Ignore runtime configuration files generated during quality assurance.

     1 // Copyright (c) 2008 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.
     5 #include "multiprocess_func_list.h"
     7 #include <map>
     9 // Helper functions to maintain mapping of "test name"->test func.
    10 // The information is accessed via a global map.
    11 namespace multi_process_function_list {
    13 namespace {
    15 typedef std::map<std::string, ChildFunctionPtr> MultiProcessTestMap;
    17 // Retrieve a reference to the global 'func name' -> func ptr map.
    18 MultiProcessTestMap &GetMultiprocessFuncMap() {
    19   static MultiProcessTestMap test_name_to_func_ptr_map;
    20   return test_name_to_func_ptr_map;
    21 }
    23 }  // namespace
    25 AppendMultiProcessTest::AppendMultiProcessTest(std::string test_name,
    26                                                ChildFunctionPtr func_ptr) {
    27   GetMultiprocessFuncMap()[test_name] = func_ptr;
    28 }
    30 int InvokeChildProcessTest(std::string test_name) {
    31   MultiProcessTestMap &func_lookup_table = GetMultiprocessFuncMap();
    32   MultiProcessTestMap::iterator it = func_lookup_table.find(test_name);
    33   if (it != func_lookup_table.end()) {
    34     ChildFunctionPtr func = it->second;
    35     if (func) {
    36       return (*func)();
    37     }
    38   }
    40   return -1;
    41 }
    43 }  // namespace multi_process_function_list

mercurial