Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Side by Side Diff: chrome/browser/ui/views/select_file_dialog_extension_browsertest.cc

Issue 10669023: Start consolidating non-port specific code to ui/base/dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clenaup Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/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"
11 #include "base/scoped_temp_dir.h" 11 #include "base/scoped_temp_dir.h"
12 #include "base/threading/platform_thread.h" 12 #include "base/threading/platform_thread.h"
13 #include "base/utf_string_conversions.h" // ASCIIToUTF16 13 #include "base/utf_string_conversions.h" // ASCIIToUTF16
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "chrome/browser/extensions/extension_browsertest.h" 15 #include "chrome/browser/extensions/extension_browsertest.h"
16 #include "chrome/browser/extensions/extension_test_message_listener.h" 16 #include "chrome/browser/extensions/extension_test_message_listener.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_navigator.h" 19 #include "chrome/browser/ui/browser_navigator.h"
20 #include "chrome/browser/ui/browser_window.h" 20 #include "chrome/browser/ui/browser_window.h"
21 #include "chrome/browser/ui/select_file_dialog.h" 21 #include "chrome/browser/ui/select_file_dialog.h"
22 #include "chrome/common/chrome_paths.h" 22 #include "chrome/common/chrome_paths.h"
23 #include "chrome/test/base/ui_test_utils.h" 23 #include "chrome/test/base/ui_test_utils.h"
24 #include "content/public/browser/notification_service.h" 24 #include "content/public/browser/notification_service.h"
25 #include "content/public/browser/notification_types.h" 25 #include "content/public/browser/notification_types.h"
26 #include "content/public/browser/render_view_host.h" 26 #include "content/public/browser/render_view_host.h"
27 #include "content/public/common/selected_file_info.h" 27 #include "ui/base/dialogs/selected_file_info.h"
28 #include "webkit/fileapi/file_system_context.h" 28 #include "webkit/fileapi/file_system_context.h"
29 #include "webkit/fileapi/file_system_mount_point_provider.h" 29 #include "webkit/fileapi/file_system_mount_point_provider.h"
30 30
31 using content::BrowserContext; 31 using content::BrowserContext;
32 32
33 // Mock listener used by test below. 33 // Mock listener used by test below.
34 class MockSelectFileDialogListener : public SelectFileDialog::Listener { 34 class MockSelectFileDialogListener : public SelectFileDialog::Listener {
35 public: 35 public:
36 MockSelectFileDialogListener() 36 MockSelectFileDialogListener()
37 : file_selected_(false), 37 : file_selected_(false),
38 canceled_(false), 38 canceled_(false),
39 params_(NULL) { 39 params_(NULL) {
40 } 40 }
41 41
42 bool file_selected() const { return file_selected_; } 42 bool file_selected() const { return file_selected_; }
43 bool canceled() const { return canceled_; } 43 bool canceled() const { return canceled_; }
44 FilePath path() const { return path_; } 44 FilePath path() const { return path_; }
45 void* params() const { return params_; } 45 void* params() const { return params_; }
46 46
47 // SelectFileDialog::Listener implementation. 47 // SelectFileDialog::Listener implementation.
48 virtual void FileSelected(const FilePath& path, int index, void* params) { 48 virtual void FileSelected(const FilePath& path, int index, void* params) {
49 file_selected_ = true; 49 file_selected_ = true;
50 path_ = path; 50 path_ = path;
51 params_ = params; 51 params_ = params;
52 } 52 }
53 virtual void FileSelectedWithExtraInfo( 53 virtual void FileSelectedWithExtraInfo(
54 const content::SelectedFileInfo& selected_file_info, 54 const ui::SelectedFileInfo& selected_file_info,
55 int index, 55 int index,
56 void* params) { 56 void* params) {
57 FileSelected(selected_file_info.path, index, params); 57 FileSelected(selected_file_info.path, index, params);
58 } 58 }
59 virtual void MultiFilesSelected( 59 virtual void MultiFilesSelected(
60 const std::vector<FilePath>& files, void* params) {} 60 const std::vector<FilePath>& files, void* params) {}
61 virtual void FileSelectionCanceled(void* params) { 61 virtual void FileSelectionCanceled(void* params) {
62 canceled_ = true; 62 canceled_ = true;
63 params_ = params; 63 params_ = params;
64 } 64 }
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 ASSERT_FALSE(second_dialog_->IsRunning(owning_window)); 339 ASSERT_FALSE(second_dialog_->IsRunning(owning_window));
340 340
341 // Click cancel button. 341 // Click cancel button.
342 CloseDialog(DIALOG_BTN_CANCEL, owning_window); 342 CloseDialog(DIALOG_BTN_CANCEL, owning_window);
343 343
344 // Listener should have been informed of the cancellation. 344 // Listener should have been informed of the cancellation.
345 ASSERT_FALSE(listener_->file_selected()); 345 ASSERT_FALSE(listener_->file_selected());
346 ASSERT_TRUE(listener_->canceled()); 346 ASSERT_TRUE(listener_->canceled());
347 ASSERT_EQ(this, listener_->params()); 347 ASSERT_EQ(this, listener_->params());
348 } 348 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698