Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: base/trace_event/trace_event_unittest.cc

Issue 1226673003: Move MatchPattern to its own header and the base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <math.h> 5 #include <math.h>
6 #include <cstdlib> 6 #include <cstdlib>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
11 #include "base/json/json_writer.h" 11 #include "base/json/json_writer.h"
12 #include "base/location.h" 12 #include "base/location.h"
13 #include "base/memory/ref_counted_memory.h" 13 #include "base/memory/ref_counted_memory.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/singleton.h" 15 #include "base/memory/singleton.h"
16 #include "base/process/process_handle.h" 16 #include "base/process/process_handle.h"
17 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
18 #include "base/strings/pattern.h"
18 #include "base/strings/stringprintf.h" 19 #include "base/strings/stringprintf.h"
19 #include "base/synchronization/waitable_event.h" 20 #include "base/synchronization/waitable_event.h"
20 #include "base/threading/platform_thread.h" 21 #include "base/threading/platform_thread.h"
21 #include "base/threading/thread.h" 22 #include "base/threading/thread.h"
22 #include "base/time/time.h" 23 #include "base/time/time.h"
23 #include "base/trace_event/trace_event.h" 24 #include "base/trace_event/trace_event.h"
24 #include "base/trace_event/trace_event_synthetic_delay.h" 25 #include "base/trace_event/trace_event_synthetic_delay.h"
25 #include "base/values.h" 26 #include "base/values.h"
26 #include "testing/gmock/include/gmock/gmock.h" 27 #include "testing/gmock/include/gmock/gmock.h"
27 #include "testing/gtest/include/gtest/gtest.h" 28 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 2203 matching lines...) Expand 10 before | Expand all | Expand 10 after
2231 dict->GetDictionary("args", &args_dict); 2232 dict->GetDictionary("args", &args_dict);
2232 ASSERT_TRUE(args_dict); 2233 ASSERT_TRUE(args_dict);
2233 EXPECT_TRUE(args_dict->GetInteger("timeticks_one", &int_value)); 2234 EXPECT_TRUE(args_dict->GetInteger("timeticks_one", &int_value));
2234 EXPECT_EQ(1, int_value); 2235 EXPECT_EQ(1, int_value);
2235 } 2236 }
2236 2237
2237 namespace { 2238 namespace {
2238 2239
2239 bool IsTraceEventArgsWhitelisted(const char* category_group_name, 2240 bool IsTraceEventArgsWhitelisted(const char* category_group_name,
2240 const char* event_name) { 2241 const char* event_name) {
2241 if (MatchPattern(category_group_name, "toplevel") && 2242 if (base::MatchPattern(category_group_name, "toplevel") &&
2242 MatchPattern(event_name, "*")) { 2243 base::MatchPattern(event_name, "*")) {
2243 return true; 2244 return true;
2244 } 2245 }
2245 2246
2246 return false; 2247 return false;
2247 } 2248 }
2248 2249
2249 } // namespace 2250 } // namespace
2250 2251
2251 TEST_F(TraceEventTestFixture, ArgsWhitelisting) { 2252 TEST_F(TraceEventTestFixture, ArgsWhitelisting) {
2252 TraceLog::GetInstance()->SetArgumentFilterPredicate( 2253 TraceLog::GetInstance()->SetArgumentFilterPredicate(
(...skipping 705 matching lines...) Expand 10 before | Expand all | Expand 10 after
2958 } 2959 }
2959 2960
2960 TEST_F(TraceEventTestFixture, SyntheticDelayConfigurationToString) { 2961 TEST_F(TraceEventTestFixture, SyntheticDelayConfigurationToString) {
2961 const char filter[] = "DELAY(test.Delay;16;oneshot)"; 2962 const char filter[] = "DELAY(test.Delay;16;oneshot)";
2962 TraceConfig config(filter, ""); 2963 TraceConfig config(filter, "");
2963 EXPECT_EQ(filter, config.ToCategoryFilterString()); 2964 EXPECT_EQ(filter, config.ToCategoryFilterString());
2964 } 2965 }
2965 2966
2966 } // namespace trace_event 2967 } // namespace trace_event
2967 } // namespace base 2968 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/trace_config.cc ('k') | chrome/browser/chromeos/accessibility/spoken_feedback_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698