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 "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // Create the dialog wrapper object, but don't show it yet. | 89 // Create the dialog wrapper object, but don't show it yet. |
90 listener_.reset(new MockSelectFileDialogListener()); | 90 listener_.reset(new MockSelectFileDialogListener()); |
91 dialog_ = new SelectFileDialogExtension(listener_.get(), NULL); | 91 dialog_ = new SelectFileDialogExtension(listener_.get(), NULL); |
92 | 92 |
93 // We have to provide at least one mount point. | 93 // We have to provide at least one mount point. |
94 // File manager looks for "Downloads" mount point, so use this name. | 94 // File manager looks for "Downloads" mount point, so use this name. |
95 base::FilePath tmp_path; | 95 base::FilePath tmp_path; |
96 PathService::Get(base::DIR_TEMP, &tmp_path); | 96 PathService::Get(base::DIR_TEMP, &tmp_path); |
97 ASSERT_TRUE(tmp_dir_.CreateUniqueTempDirUnderPath(tmp_path)); | 97 ASSERT_TRUE(tmp_dir_.CreateUniqueTempDirUnderPath(tmp_path)); |
98 downloads_dir_ = tmp_dir_.path().Append("Downloads"); | 98 downloads_dir_ = tmp_dir_.path().Append("Downloads"); |
99 file_util::CreateDirectory(downloads_dir_); | 99 base::CreateDirectory(downloads_dir_); |
100 | 100 |
101 // Must run after our setup because it actually runs the test. | 101 // Must run after our setup because it actually runs the test. |
102 ExtensionBrowserTest::SetUp(); | 102 ExtensionBrowserTest::SetUp(); |
103 } | 103 } |
104 | 104 |
105 virtual void TearDown() OVERRIDE { | 105 virtual void TearDown() OVERRIDE { |
106 ExtensionBrowserTest::TearDown(); | 106 ExtensionBrowserTest::TearDown(); |
107 | 107 |
108 // Delete the dialog first, as it holds a pointer to the listener. | 108 // Delete the dialog first, as it holds a pointer to the listener. |
109 dialog_ = NULL; | 109 dialog_ = NULL; |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 ASSERT_FALSE(second_dialog_->IsRunning(owning_window)); | 365 ASSERT_FALSE(second_dialog_->IsRunning(owning_window)); |
366 | 366 |
367 // Click cancel button. | 367 // Click cancel button. |
368 CloseDialog(DIALOG_BTN_CANCEL, owning_window); | 368 CloseDialog(DIALOG_BTN_CANCEL, owning_window); |
369 | 369 |
370 // Listener should have been informed of the cancellation. | 370 // Listener should have been informed of the cancellation. |
371 ASSERT_FALSE(listener_->file_selected()); | 371 ASSERT_FALSE(listener_->file_selected()); |
372 ASSERT_TRUE(listener_->canceled()); | 372 ASSERT_TRUE(listener_->canceled()); |
373 ASSERT_EQ(this, listener_->params()); | 373 ASSERT_EQ(this, listener_->params()); |
374 } | 374 } |
OLD | NEW |