| OLD | NEW |
| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "chrome/browser/character_encoding.h" | 9 #include "chrome/browser/character_encoding.h" |
| 10 #include "chrome/browser/net/url_request_mock_util.h" | 10 #include "chrome/browser/net/url_request_mock_util.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 callback_(callback) { | 73 callback_(callback) { |
| 74 download_manager_->AddObserver(this); | 74 download_manager_->AddObserver(this); |
| 75 } | 75 } |
| 76 | 76 |
| 77 virtual ~SavePackageFinishedObserver() { | 77 virtual ~SavePackageFinishedObserver() { |
| 78 if (download_manager_) | 78 if (download_manager_) |
| 79 download_manager_->RemoveObserver(this); | 79 download_manager_->RemoveObserver(this); |
| 80 } | 80 } |
| 81 | 81 |
| 82 // DownloadManager::Observer: | 82 // DownloadManager::Observer: |
| 83 virtual void OnSavePackageSuccessfullyFinished( | 83 virtual void OnSavePackageFinished( |
| 84 content::DownloadManager* manager, content::DownloadItem* item) OVERRIDE { | 84 bool success, |
| 85 content::DownloadManager* manager, |
| 86 content::DownloadItem* item) OVERRIDE { |
| 85 callback_.Run(); | 87 callback_.Run(); |
| 86 } | 88 } |
| 87 virtual void ManagerGoingDown(content::DownloadManager* manager) OVERRIDE { | 89 virtual void ManagerGoingDown(content::DownloadManager* manager) OVERRIDE { |
| 88 download_manager_->RemoveObserver(this); | 90 download_manager_->RemoveObserver(this); |
| 89 download_manager_ = NULL; | 91 download_manager_ = NULL; |
| 90 } | 92 } |
| 91 | 93 |
| 92 private: | 94 private: |
| 93 content::DownloadManager* download_manager_; | 95 content::DownloadManager* download_manager_; |
| 94 base::Closure callback_; | 96 base::Closure callback_; |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 | 325 |
| 324 // Dump the page, the content of dump page should be equal with our expect | 326 // Dump the page, the content of dump page should be equal with our expect |
| 325 // result file. | 327 // result file. |
| 326 base::FilePath expected_result_file_name = | 328 base::FilePath expected_result_file_name = |
| 327 base::FilePath().AppendASCII(kAutoDetectDir). | 329 base::FilePath().AppendASCII(kAutoDetectDir). |
| 328 AppendASCII(kExpectedResultDir). | 330 AppendASCII(kExpectedResultDir). |
| 329 AppendASCII(kTestDatas[i].expected_result); | 331 AppendASCII(kTestDatas[i].expected_result); |
| 330 SaveAndCompare(kTestDatas[i].test_file_name, expected_result_file_name); | 332 SaveAndCompare(kTestDatas[i].test_file_name, expected_result_file_name); |
| 331 } | 333 } |
| 332 } | 334 } |
| OLD | NEW |