| OLD | NEW | 
|   1 /* |   1 /* | 
|   2  *  Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. |   2  *  Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 
|   3  * |   3  * | 
|   4  *  Use of this source code is governed by a BSD-style license |   4  *  Use of this source code is governed by a BSD-style license | 
|   5  *  that can be found in the LICENSE file in the root of the source |   5  *  that can be found in the LICENSE file in the root of the source | 
|   6  *  tree. An additional intellectual property rights grant can be found |   6  *  tree. An additional intellectual property rights grant can be found | 
|   7  *  in the file PATENTS.  All contributing project authors may |   7  *  in the file PATENTS.  All contributing project authors may | 
|   8  *  be found in the AUTHORS file in the root of the source tree. |   8  *  be found in the AUTHORS file in the root of the source tree. | 
|   9  */ |   9  */ | 
|  10 #include "webrtc/modules/audio_processing/include/config.h" |  10 #include "webrtc/modules/audio_processing/include/config.h" | 
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  43   Config config; |  43   Config config; | 
|  44   config.Set<MyExperiment>(new MyExperiment(5, 1)); |  44   config.Set<MyExperiment>(new MyExperiment(5, 1)); | 
|  45   const MyExperiment& my_exp = config.Get<MyExperiment>(); |  45   const MyExperiment& my_exp = config.Get<MyExperiment>(); | 
|  46   EXPECT_EQ(5, my_exp.factor); |  46   EXPECT_EQ(5, my_exp.factor); | 
|  47   EXPECT_EQ(1, my_exp.offset); |  47   EXPECT_EQ(1, my_exp.offset); | 
|  48 } |  48 } | 
|  49  |  49  | 
|  50 TEST(Config, SetNullSetsTheOptionBackToDefault) { |  50 TEST(Config, SetNullSetsTheOptionBackToDefault) { | 
|  51   Config config; |  51   Config config; | 
|  52   config.Set<MyExperiment>(new MyExperiment(5, 1)); |  52   config.Set<MyExperiment>(new MyExperiment(5, 1)); | 
|  53   config.Set<MyExperiment>(NULL); |  53   config.Set<MyExperiment>(nullptr); | 
|  54   const MyExperiment& my_exp = config.Get<MyExperiment>(); |  54   const MyExperiment& my_exp = config.Get<MyExperiment>(); | 
|  55   EXPECT_EQ(MyExperiment::kDefaultFactor, my_exp.factor); |  55   EXPECT_EQ(MyExperiment::kDefaultFactor, my_exp.factor); | 
|  56   EXPECT_EQ(MyExperiment::kDefaultOffset, my_exp.offset); |  56   EXPECT_EQ(MyExperiment::kDefaultOffset, my_exp.offset); | 
|  57 } |  57 } | 
|  58  |  58  | 
|  59 struct Algo1_CostFunction { |  59 struct Algo1_CostFunction { | 
|  60   static const ConfigOptionID identifier = |  60   static const ConfigOptionID identifier = | 
|  61       ConfigOptionID::kAlgo1CostFunctionForTest; |  61       ConfigOptionID::kAlgo1CostFunctionForTest; | 
|  62   Algo1_CostFunction() {} |  62   Algo1_CostFunction() {} | 
|  63  |  63  | 
| (...skipping 10 matching lines...) Expand all  Loading... | 
|  74   } |  74   } | 
|  75 }; |  75 }; | 
|  76  |  76  | 
|  77 TEST(Config, SupportsPolymorphism) { |  77 TEST(Config, SupportsPolymorphism) { | 
|  78   Config config; |  78   Config config; | 
|  79   config.Set<Algo1_CostFunction>(new SqrCost()); |  79   config.Set<Algo1_CostFunction>(new SqrCost()); | 
|  80   EXPECT_EQ(25, config.Get<Algo1_CostFunction>().cost(5)); |  80   EXPECT_EQ(25, config.Get<Algo1_CostFunction>().cost(5)); | 
|  81 } |  81 } | 
|  82 }  // namespace |  82 }  // namespace | 
|  83 }  // namespace webrtc |  83 }  // namespace webrtc | 
| OLD | NEW |