| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/prefs/pref_service.h" | 6 #include "base/prefs/pref_service.h" |
| 7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/ui/browser_commands.h" | 9 #include "chrome/browser/ui/browser_commands.h" |
| 10 #include "chrome/browser/ui/browser_list.h" | 10 #include "chrome/browser/ui/browser_list.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 int get_receive_count() const { return receive_count_; } | 66 int get_receive_count() const { return receive_count_; } |
| 67 bool get_started_finalizations() const { | 67 bool get_started_finalizations() const { |
| 68 return started_finalizations_count_; | 68 return started_finalizations_count_; |
| 69 } | 69 } |
| 70 bool get_last_started_finalization_success() const { | 70 bool get_last_started_finalization_success() const { |
| 71 return last_on_started_finalizing_success_; | 71 return last_on_started_finalizing_success_; |
| 72 } | 72 } |
| 73 | 73 |
| 74 private: | 74 private: |
| 75 void OnUpload(const scoped_refptr<base::RefCountedString>& file_contents, | 75 void OnUpload(const scoped_refptr<base::RefCountedString>& file_contents, |
| 76 const std::map<std::string, std::string>& metadata, |
| 76 base::Callback<void()> done_callback) { | 77 base::Callback<void()> done_callback) { |
| 77 receive_count_ += 1; | 78 receive_count_ += 1; |
| 78 | 79 |
| 79 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 80 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
| 80 base::Bind(done_callback)); | 81 base::Bind(done_callback)); |
| 81 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 82 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
| 82 base::Bind(on_upload_callback_)); | 83 base::Bind(on_upload_callback_)); |
| 83 } | 84 } |
| 84 | 85 |
| 85 void OnStartedFinalizing(bool success) { | 86 void OnStartedFinalizing(bool success) { |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 | 179 |
| 179 base::RunLoop wait_for_finalization_start; | 180 base::RunLoop wait_for_finalization_start; |
| 180 TriggerReactiveScenario(wait_for_finalization_start.QuitClosure()); | 181 TriggerReactiveScenario(wait_for_finalization_start.QuitClosure()); |
| 181 wait_for_finalization_start.Run(); | 182 wait_for_finalization_start.Run(); |
| 182 | 183 |
| 183 EXPECT_TRUE(get_started_finalizations() == 1); | 184 EXPECT_TRUE(get_started_finalizations() == 1); |
| 184 EXPECT_FALSE(get_last_started_finalization_success()); | 185 EXPECT_FALSE(get_last_started_finalization_success()); |
| 185 } | 186 } |
| 186 | 187 |
| 187 } // namespace | 188 } // namespace |
| OLD | NEW |