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

Side by Side Diff: chrome/browser/ui/select_file_dialog_unittest.cc

Issue 8677014: Build & run unit tests on Aura (Rebase) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years 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) 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 "base/file_path.h" 5 #include "base/file_path.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/string16.h" 7 #include "base/string16.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/prefs/browser_prefs.h" 10 #include "chrome/browser/prefs/browser_prefs.h"
11 #include "chrome/browser/prefs/pref_service.h" 11 #include "chrome/browser/prefs/pref_service.h"
12 #include "chrome/browser/ui/browser.h" 12 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/select_file_dialog.h" 13 #include "chrome/browser/ui/select_file_dialog.h"
14 #include "chrome/common/pref_names.h" 14 #include "chrome/common/pref_names.h"
15 #include "chrome/test/base/testing_browser_process.h" 15 #include "chrome/test/base/testing_browser_process.h"
16 #include "chrome/test/base/testing_pref_service.h" 16 #include "chrome/test/base/testing_pref_service.h"
17 #include "content/test/test_browser_thread.h" 17 #include "content/test/test_browser_thread.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 19
20 #if defined(USE_AURA) && defined(OS_WIN)
21 // http://crbug.com/105200
22 #define MAYBE_ExpectAsynchronousListenerCall DISABLED_ExpectAsynchronousListener Call
23 #else
24 #define MAYBE_ExpectAsynchronousListenerCall ExpectAsynchronousListenerCall
25 #endif
26
20 using content::BrowserThread; 27 using content::BrowserThread;
21 28
22 class FileSelectionUser : public SelectFileDialog::Listener { 29 class FileSelectionUser : public SelectFileDialog::Listener {
23 public: 30 public:
24 FileSelectionUser() 31 FileSelectionUser()
25 : file_selection_initialisation_in_progress(false) { 32 : file_selection_initialisation_in_progress(false) {
26 } 33 }
27 34
28 ~FileSelectionUser() { 35 ~FileSelectionUser() {
29 if (select_file_dialog_.get()) 36 if (select_file_dialog_.get())
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 private: 74 private:
68 scoped_refptr<SelectFileDialog> select_file_dialog_; 75 scoped_refptr<SelectFileDialog> select_file_dialog_;
69 76
70 bool file_selection_initialisation_in_progress; 77 bool file_selection_initialisation_in_progress;
71 }; 78 };
72 79
73 typedef testing::Test FileSelectionDialogTest; 80 typedef testing::Test FileSelectionDialogTest;
74 81
75 // Tests if SelectFileDialog::SelectFile returns asynchronously with 82 // Tests if SelectFileDialog::SelectFile returns asynchronously with
76 // file-selection dialogs disabled by policy. 83 // file-selection dialogs disabled by policy.
77 TEST_F(FileSelectionDialogTest, ExpectAsynchronousListenerCall) { 84 TEST_F(FileSelectionDialogTest, MAYBE_ExpectAsynchronousListenerCall) {
78 MessageLoopForUI message_loop; 85 MessageLoopForUI message_loop;
79 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop); 86 content::TestBrowserThread ui_thread(BrowserThread::UI, &message_loop);
80 87
81 ScopedTestingLocalState local_state( 88 ScopedTestingLocalState local_state(
82 static_cast<TestingBrowserProcess*>(g_browser_process)); 89 static_cast<TestingBrowserProcess*>(g_browser_process));
83 90
84 scoped_ptr<FileSelectionUser> file_selection_user(new FileSelectionUser()); 91 scoped_ptr<FileSelectionUser> file_selection_user(new FileSelectionUser());
85 92
86 // Disallow file-selection dialogs. 93 // Disallow file-selection dialogs.
87 local_state.Get()->SetManagedPref( 94 local_state.Get()->SetManagedPref(
88 prefs::kAllowFileSelectionDialogs, 95 prefs::kAllowFileSelectionDialogs,
89 Value::CreateBooleanValue(false)); 96 Value::CreateBooleanValue(false));
90 97
91 file_selection_user->StartFileSelection(); 98 file_selection_user->StartFileSelection();
92 } 99 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698