OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <utility> |
| 6 |
5 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
6 #include "base/bind.h" | 8 #include "base/bind.h" |
7 #include "base/command_line.h" | 9 #include "base/command_line.h" |
8 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
9 #include "build/build_config.h" | 11 #include "build/build_config.h" |
10 #include "chrome/app/chrome_command_ids.h" | 12 #include "chrome/app/chrome_command_ids.h" |
11 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/tracing/background_tracing_field_trial.h" | 14 #include "chrome/browser/tracing/background_tracing_field_trial.h" |
13 #include "chrome/browser/ui/browser_commands.h" | 15 #include "chrome/browser/ui/browser_commands.h" |
14 #include "chrome/browser/ui/browser_list.h" | 16 #include "chrome/browser/ui/browser_list.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 base::DictionaryValue dict; | 48 base::DictionaryValue dict; |
47 | 49 |
48 dict.SetString("mode", "PREEMPTIVE_TRACING_MODE"); | 50 dict.SetString("mode", "PREEMPTIVE_TRACING_MODE"); |
49 dict.SetString("category", "BENCHMARK"); | 51 dict.SetString("category", "BENCHMARK"); |
50 | 52 |
51 scoped_ptr<base::ListValue> rules_list(new base::ListValue()); | 53 scoped_ptr<base::ListValue> rules_list(new base::ListValue()); |
52 { | 54 { |
53 scoped_ptr<base::DictionaryValue> rules_dict(new base::DictionaryValue()); | 55 scoped_ptr<base::DictionaryValue> rules_dict(new base::DictionaryValue()); |
54 rules_dict->SetString("rule", "MONITOR_AND_DUMP_WHEN_TRIGGER_NAMED"); | 56 rules_dict->SetString("rule", "MONITOR_AND_DUMP_WHEN_TRIGGER_NAMED"); |
55 rules_dict->SetString("trigger_name", "test"); | 57 rules_dict->SetString("trigger_name", "test"); |
56 rules_list->Append(rules_dict.Pass()); | 58 rules_list->Append(std::move(rules_dict)); |
57 } | 59 } |
58 dict.Set("configs", rules_list.Pass()); | 60 dict.Set("configs", std::move(rules_list)); |
59 | 61 |
60 scoped_ptr<content::BackgroundTracingConfig> config( | 62 scoped_ptr<content::BackgroundTracingConfig> config( |
61 content::BackgroundTracingConfig::FromDict(&dict)); | 63 content::BackgroundTracingConfig::FromDict(&dict)); |
62 | 64 |
63 DCHECK(config); | 65 DCHECK(config); |
64 content::BackgroundTracingManager::ReceiveCallback receive_callback = | 66 content::BackgroundTracingManager::ReceiveCallback receive_callback = |
65 base::Bind(&ChromeTracingDelegateBrowserTest::OnUpload, | 67 base::Bind(&ChromeTracingDelegateBrowserTest::OnUpload, |
66 base::Unretained(this)); | 68 base::Unretained(this)); |
67 | 69 |
68 return content::BackgroundTracingManager::GetInstance()->SetActiveScenario( | 70 return content::BackgroundTracingManager::GetInstance()->SetActiveScenario( |
69 config.Pass(), receive_callback, data_filtering); | 71 std::move(config), receive_callback, data_filtering); |
70 } | 72 } |
71 | 73 |
72 void TriggerPreemptiveScenario( | 74 void TriggerPreemptiveScenario( |
73 const base::Closure& on_started_finalization_callback) { | 75 const base::Closure& on_started_finalization_callback) { |
74 on_started_finalization_callback_ = on_started_finalization_callback; | 76 on_started_finalization_callback_ = on_started_finalization_callback; |
75 trigger_handle_ = | 77 trigger_handle_ = |
76 content::BackgroundTracingManager::GetInstance()->RegisterTriggerType( | 78 content::BackgroundTracingManager::GetInstance()->RegisterTriggerType( |
77 "test"); | 79 "test"); |
78 | 80 |
79 content::BackgroundTracingManager::StartedFinalizingCallback | 81 content::BackgroundTracingManager::StartedFinalizingCallback |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 276 |
275 IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTestOnStartup, | 277 IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTestOnStartup, |
276 StartupTracingThrottle) { | 278 StartupTracingThrottle) { |
277 // The startup scenario should *not* be started, since not enough | 279 // The startup scenario should *not* be started, since not enough |
278 // time has elapsed since the last upload (set in the PRE_ above). | 280 // time has elapsed since the last upload (set in the PRE_ above). |
279 EXPECT_FALSE( | 281 EXPECT_FALSE( |
280 content::BackgroundTracingManager::GetInstance()->HasActiveScenario()); | 282 content::BackgroundTracingManager::GetInstance()->HasActiveScenario()); |
281 } | 283 } |
282 | 284 |
283 } // namespace | 285 } // namespace |
OLD | NEW |