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

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

Issue 8523006: Don't show FileManagerDialog if another FileManagerDialog is shown in the same tab. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: space Created 9 years, 1 month 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
« no previous file with comments | « chrome/browser/ui/views/file_manager_dialog_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/browser/ui/views/file_manager_dialog.h" 5 #include "chrome/browser/ui/views/file_manager_dialog.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 class FileManagerDialogTest : public testing::Test { 10 class FileManagerDialogTest : public testing::Test {
11 public: 11 public:
12 static FileManagerDialog* CreateDialog(SelectFileDialog::Listener* listener, 12 static FileManagerDialog* CreateDialog(SelectFileDialog::Listener* listener,
13 int32 tab_id) { 13 int32 tab_id) {
14 FileManagerDialog* dialog = new FileManagerDialog(listener); 14 FileManagerDialog* dialog = new FileManagerDialog(listener);
15 // Simulate the dialog opening. 15 // Simulate the dialog opening.
16 EXPECT_FALSE(FileManagerDialog::PendingExists(tab_id));
16 dialog->AddPending(tab_id); 17 dialog->AddPending(tab_id);
18 EXPECT_TRUE(FileManagerDialog::PendingExists(tab_id));
17 return dialog; 19 return dialog;
18 } 20 }
19 }; 21 };
20 22
21 // Client of a FileManagerDialog that deletes itself whenever the dialog 23 // Client of a FileManagerDialog that deletes itself whenever the dialog
22 // is closed. 24 // is closed.
23 class SelfDeletingClient : public SelectFileDialog::Listener { 25 class SelfDeletingClient : public SelectFileDialog::Listener {
24 public: 26 public:
25 explicit SelfDeletingClient(int32 tab_id) { 27 explicit SelfDeletingClient(int32 tab_id) {
26 dialog_ = FileManagerDialogTest::CreateDialog(this, tab_id); 28 dialog_ = FileManagerDialogTest::CreateDialog(this, tab_id);
(...skipping 16 matching lines...) Expand all
43 45
44 TEST_F(FileManagerDialogTest, FileManagerDialogMemory) { 46 TEST_F(FileManagerDialogTest, FileManagerDialogMemory) {
45 const int32 kTabId = 123; 47 const int32 kTabId = 123;
46 // Registers itself with an internal map, so we don't need the pointer, 48 // Registers itself with an internal map, so we don't need the pointer,
47 // and it would be unused anyway. 49 // and it would be unused anyway.
48 new SelfDeletingClient(kTabId); 50 new SelfDeletingClient(kTabId);
49 // Ensure we don't crash or trip an Address Sanitizer warning about 51 // Ensure we don't crash or trip an Address Sanitizer warning about
50 // use-after-free. 52 // use-after-free.
51 FileManagerDialog::OnFileSelected(kTabId, FilePath(), 0); 53 FileManagerDialog::OnFileSelected(kTabId, FilePath(), 0);
52 } 54 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/file_manager_dialog_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698