OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_manager_dialog.h" | 5 #include "chrome/browser/ui/views/file_manager_dialog.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 ASSERT_FALSE(dialog_->IsRunning(native_window)); | 101 ASSERT_FALSE(dialog_->IsRunning(native_window)); |
102 } | 102 } |
103 | 103 |
104 IN_PROC_BROWSER_TEST_F(FileManagerDialogTest, FileManagerDestroyListener) { | 104 IN_PROC_BROWSER_TEST_F(FileManagerDialogTest, FileManagerDestroyListener) { |
105 // Some users of SelectFileDialog destroy their listener before cleaning | 105 // Some users of SelectFileDialog destroy their listener before cleaning |
106 // up the dialog. Make sure we don't crash. | 106 // up the dialog. Make sure we don't crash. |
107 dialog_->ListenerDestroyed(); | 107 dialog_->ListenerDestroyed(); |
108 listener_.reset(); | 108 listener_.reset(); |
109 } | 109 } |
110 | 110 |
111 IN_PROC_BROWSER_TEST_F(FileManagerDialogTest, SelectFileAndCancel) { | 111 // Flaky: http://crbug.com/89733 |
| 112 IN_PROC_BROWSER_TEST_F(FileManagerDialogTest, FLAKY_SelectFileAndCancel) { |
112 // Spawn a dialog to open a file. The dialog will signal that it is done | 113 // Spawn a dialog to open a file. The dialog will signal that it is done |
113 // loading via chrome.test.sendMessage('ready') in the extension JavaScript. | 114 // loading via chrome.test.sendMessage('ready') in the extension JavaScript. |
114 ExtensionTestMessageListener msg_listener("ready", false /* will_reply */); | 115 ExtensionTestMessageListener msg_listener("ready", false /* will_reply */); |
115 gfx::NativeWindow owning_window = browser()->window()->GetNativeHandle(); | 116 gfx::NativeWindow owning_window = browser()->window()->GetNativeHandle(); |
116 dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE, | 117 dialog_->SelectFile(SelectFileDialog::SELECT_OPEN_FILE, |
117 string16() /* title */, | 118 string16() /* title */, |
118 FilePath() /* default_path */, | 119 FilePath() /* default_path */, |
119 NULL /* file_types */, | 120 NULL /* file_types */, |
120 0 /* file_type_index */, | 121 0 /* file_type_index */, |
121 FILE_PATH_LITERAL("") /* default_extension */, | 122 FILE_PATH_LITERAL("") /* default_extension */, |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 | 271 |
271 // Dialog no longer believes it is running. | 272 // Dialog no longer believes it is running. |
272 ASSERT_FALSE(dialog_->IsRunning(owning_window)); | 273 ASSERT_FALSE(dialog_->IsRunning(owning_window)); |
273 | 274 |
274 // Listener should have been informed that the file was selected. | 275 // Listener should have been informed that the file was selected. |
275 ASSERT_TRUE(listener_->file_selected()); | 276 ASSERT_TRUE(listener_->file_selected()); |
276 ASSERT_FALSE(listener_->canceled()); | 277 ASSERT_FALSE(listener_->canceled()); |
277 ASSERT_EQ(test_file, listener_->path()); | 278 ASSERT_EQ(test_file, listener_->path()); |
278 ASSERT_EQ(this, listener_->params()); | 279 ASSERT_EQ(this, listener_->params()); |
279 } | 280 } |
OLD | NEW |