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/ui/views/select_file_dialog_extension.h" | 5 #include "chrome/browser/ui/views/select_file_dialog_extension.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 // Create the dialog wrapper object, but don't show it yet. | 105 // Create the dialog wrapper object, but don't show it yet. |
106 listener_.reset(new MockSelectFileDialogListener()); | 106 listener_.reset(new MockSelectFileDialogListener()); |
107 dialog_ = new SelectFileDialogExtension(listener_.get(), NULL); | 107 dialog_ = new SelectFileDialogExtension(listener_.get(), NULL); |
108 | 108 |
109 // We have to provide at least one mount point. | 109 // We have to provide at least one mount point. |
110 // File manager looks for "Downloads" mount point, so use this name. | 110 // File manager looks for "Downloads" mount point, so use this name. |
111 base::FilePath tmp_path; | 111 base::FilePath tmp_path; |
112 PathService::Get(base::DIR_TEMP, &tmp_path); | 112 PathService::Get(base::DIR_TEMP, &tmp_path); |
113 ASSERT_TRUE(tmp_dir_.CreateUniqueTempDirUnderPath(tmp_path)); | 113 ASSERT_TRUE(tmp_dir_.CreateUniqueTempDirUnderPath(tmp_path)); |
114 downloads_dir_ = tmp_dir_.path().Append("Downloads"); | 114 downloads_dir_ = tmp_dir_.GetPath().Append("Downloads"); |
115 base::CreateDirectory(downloads_dir_); | 115 base::CreateDirectory(downloads_dir_); |
116 | 116 |
117 // Must run after our setup because it actually runs the test. | 117 // Must run after our setup because it actually runs the test. |
118 ExtensionBrowserTest::SetUp(); | 118 ExtensionBrowserTest::SetUp(); |
119 } | 119 } |
120 | 120 |
121 void TearDown() override { | 121 void TearDown() override { |
122 ExtensionBrowserTest::TearDown(); | 122 ExtensionBrowserTest::TearDown(); |
123 | 123 |
124 // Delete the dialog first, as it holds a pointer to the listener. | 124 // Delete the dialog first, as it holds a pointer to the listener. |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
399 ASSERT_FALSE(second_dialog_->IsRunning(owning_window)); | 399 ASSERT_FALSE(second_dialog_->IsRunning(owning_window)); |
400 | 400 |
401 // Click cancel button. | 401 // Click cancel button. |
402 CloseDialog(DIALOG_BTN_CANCEL, owning_window); | 402 CloseDialog(DIALOG_BTN_CANCEL, owning_window); |
403 | 403 |
404 // Listener should have been informed of the cancellation. | 404 // Listener should have been informed of the cancellation. |
405 ASSERT_FALSE(listener_->file_selected()); | 405 ASSERT_FALSE(listener_->file_selected()); |
406 ASSERT_TRUE(listener_->canceled()); | 406 ASSERT_TRUE(listener_->canceled()); |
407 ASSERT_EQ(this, listener_->params()); | 407 ASSERT_EQ(this, listener_->params()); |
408 } | 408 } |
OLD | NEW |