| 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> | 5 #include <utility> |
| 6 | 6 |
| 7 #include "base/base_switches.h" | 7 #include "base/base_switches.h" |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 return last_on_started_finalizing_success_; | 95 return last_on_started_finalizing_success_; |
| 96 } | 96 } |
| 97 | 97 |
| 98 private: | 98 private: |
| 99 void OnUpload(const scoped_refptr<base::RefCountedString>& file_contents, | 99 void OnUpload(const scoped_refptr<base::RefCountedString>& file_contents, |
| 100 std::unique_ptr<const base::DictionaryValue> metadata, | 100 std::unique_ptr<const base::DictionaryValue> metadata, |
| 101 base::Callback<void()> done_callback) { | 101 base::Callback<void()> done_callback) { |
| 102 receive_count_ += 1; | 102 receive_count_ += 1; |
| 103 | 103 |
| 104 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 104 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
| 105 base::Bind(done_callback)); | 105 done_callback); |
| 106 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 106 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
| 107 base::Bind(on_upload_callback_)); | 107 on_upload_callback_); |
| 108 } | 108 } |
| 109 | 109 |
| 110 void OnStartedFinalizing(bool success) { | 110 void OnStartedFinalizing(bool success) { |
| 111 started_finalizations_count_++; | 111 started_finalizations_count_++; |
| 112 last_on_started_finalizing_success_ = success; | 112 last_on_started_finalizing_success_ = success; |
| 113 | 113 |
| 114 if (!on_started_finalization_callback_.is_null()) { | 114 if (!on_started_finalization_callback_.is_null()) { |
| 115 content::BrowserThread::PostTask( | 115 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
| 116 content::BrowserThread::UI, FROM_HERE, | 116 on_started_finalization_callback_); |
| 117 base::Bind(on_started_finalization_callback_)); | |
| 118 } | 117 } |
| 119 } | 118 } |
| 120 | 119 |
| 121 base::Closure on_upload_callback_; | 120 base::Closure on_upload_callback_; |
| 122 base::Closure on_started_finalization_callback_; | 121 base::Closure on_started_finalization_callback_; |
| 123 int receive_count_; | 122 int receive_count_; |
| 124 int started_finalizations_count_; | 123 int started_finalizations_count_; |
| 125 content::BackgroundTracingManager::TriggerHandle trigger_handle_; | 124 content::BackgroundTracingManager::TriggerHandle trigger_handle_; |
| 126 bool last_on_started_finalizing_success_; | 125 bool last_on_started_finalizing_success_; |
| 127 }; | 126 }; |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 | 276 |
| 278 IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTestOnStartup, | 277 IN_PROC_BROWSER_TEST_F(ChromeTracingDelegateBrowserTestOnStartup, |
| 279 StartupTracingThrottle) { | 278 StartupTracingThrottle) { |
| 280 // The startup scenario should *not* be started, since not enough | 279 // The startup scenario should *not* be started, since not enough |
| 281 // 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). |
| 282 EXPECT_FALSE( | 281 EXPECT_FALSE( |
| 283 content::BackgroundTracingManager::GetInstance()->HasActiveScenario()); | 282 content::BackgroundTracingManager::GetInstance()->HasActiveScenario()); |
| 284 } | 283 } |
| 285 | 284 |
| 286 } // namespace | 285 } // namespace |
| OLD | NEW |