| 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 "chrome/browser/plugin_download_helper.h" | 5 #include "chrome/browser/plugin_download_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 download_helper_->InitiateDownload( | 66 download_helper_->InitiateDownload( |
| 67 initial_download_path_, | 67 initial_download_path_, |
| 68 context_getter, | 68 context_getter, |
| 69 base::Bind(&PluginInstallerDownloadTest::OnDownloadCompleted, | 69 base::Bind(&PluginInstallerDownloadTest::OnDownloadCompleted, |
| 70 base::Unretained(this)), | 70 base::Unretained(this)), |
| 71 base::Bind(&PluginInstallerDownloadTest::OnDownloadError, | 71 base::Bind(&PluginInstallerDownloadTest::OnDownloadError, |
| 72 base::Unretained(this))); | 72 base::Unretained(this))); |
| 73 | 73 |
| 74 message_loop_.PostDelayedTask( | 74 message_loop_.PostDelayedTask( |
| 75 FROM_HERE, MessageLoop::QuitClosure(), | 75 FROM_HERE, MessageLoop::QuitClosure(), |
| 76 TestTimeouts::action_max_timeout_ms()); | 76 TestTimeouts::action_max_timeout()); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void OnDownloadCompleted(const FilePath& download_path) { | 79 void OnDownloadCompleted(const FilePath& download_path) { |
| 80 success_ = true; | 80 success_ = true; |
| 81 final_download_path_ = download_path; | 81 final_download_path_ = download_path; |
| 82 message_loop_.Quit(); | 82 message_loop_.Quit(); |
| 83 download_helper_ = NULL; | 83 download_helper_ = NULL; |
| 84 } | 84 } |
| 85 | 85 |
| 86 void OnDownloadError(const std::string& error) { | 86 void OnDownloadError(const std::string& error) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 113 // This test validates that the plugin downloader downloads the specified file | 113 // This test validates that the plugin downloader downloads the specified file |
| 114 // to a temporary path with the same file name. | 114 // to a temporary path with the same file name. |
| 115 TEST_F(PluginInstallerDownloadTest, PluginInstallerDownloadPathTest) { | 115 TEST_F(PluginInstallerDownloadTest, PluginInstallerDownloadPathTest) { |
| 116 Start(); | 116 Start(); |
| 117 MessageLoop::current()->Run(); | 117 MessageLoop::current()->Run(); |
| 118 | 118 |
| 119 ASSERT_TRUE(success()); | 119 ASSERT_TRUE(success()); |
| 120 EXPECT_TRUE(initial_download_path().BaseName().value() == | 120 EXPECT_TRUE(initial_download_path().BaseName().value() == |
| 121 final_download_path().BaseName().value()); | 121 final_download_path().BaseName().value()); |
| 122 } | 122 } |
| OLD | NEW |