| 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/logging.h" | 9 #include "base/logging.h" | 
| 9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" | 
| 10 #include "base/path_service.h" | 11 #include "base/path_service.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/common/chrome_paths.h" | 21 #include "chrome/common/chrome_paths.h" | 
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 196     // Dialog no longer believes it is running. | 196     // Dialog no longer believes it is running. | 
| 197     ASSERT_FALSE(dialog_->IsRunning(owning_window)); | 197     ASSERT_FALSE(dialog_->IsRunning(owning_window)); | 
| 198   } | 198   } | 
| 199 | 199 | 
| 200   scoped_ptr<MockSelectFileDialogListener> listener_; | 200   scoped_ptr<MockSelectFileDialogListener> listener_; | 
| 201   scoped_refptr<SelectFileDialogExtension> dialog_; | 201   scoped_refptr<SelectFileDialogExtension> dialog_; | 
| 202 | 202 | 
| 203   scoped_ptr<MockSelectFileDialogListener> second_listener_; | 203   scoped_ptr<MockSelectFileDialogListener> second_listener_; | 
| 204   scoped_refptr<SelectFileDialogExtension> second_dialog_; | 204   scoped_refptr<SelectFileDialogExtension> second_dialog_; | 
| 205 | 205 | 
| 206   ScopedTempDir tmp_dir_; | 206   base::ScopedTempDir tmp_dir_; | 
| 207   FilePath downloads_dir_; | 207   FilePath downloads_dir_; | 
| 208 }; | 208 }; | 
| 209 | 209 | 
| 210 IN_PROC_BROWSER_TEST_F(SelectFileDialogExtensionBrowserTest, CreateAndDestroy) { | 210 IN_PROC_BROWSER_TEST_F(SelectFileDialogExtensionBrowserTest, CreateAndDestroy) { | 
| 211   // Browser window must be up for us to test dialog window parent. | 211   // Browser window must be up for us to test dialog window parent. | 
| 212   gfx::NativeWindow native_window = browser()->window()->GetNativeWindow(); | 212   gfx::NativeWindow native_window = browser()->window()->GetNativeWindow(); | 
| 213   ASSERT_TRUE(native_window != NULL); | 213   ASSERT_TRUE(native_window != NULL); | 
| 214 | 214 | 
| 215   // Before we call SelectFile, dialog is not running/visible. | 215   // Before we call SelectFile, dialog is not running/visible. | 
| 216   ASSERT_FALSE(dialog_->IsRunning(native_window)); | 216   ASSERT_FALSE(dialog_->IsRunning(native_window)); | 
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 343   ASSERT_FALSE(second_dialog_->IsRunning(owning_window)); | 343   ASSERT_FALSE(second_dialog_->IsRunning(owning_window)); | 
| 344 | 344 | 
| 345   // Click cancel button. | 345   // Click cancel button. | 
| 346   CloseDialog(DIALOG_BTN_CANCEL, owning_window); | 346   CloseDialog(DIALOG_BTN_CANCEL, owning_window); | 
| 347 | 347 | 
| 348   // Listener should have been informed of the cancellation. | 348   // Listener should have been informed of the cancellation. | 
| 349   ASSERT_FALSE(listener_->file_selected()); | 349   ASSERT_FALSE(listener_->file_selected()); | 
| 350   ASSERT_TRUE(listener_->canceled()); | 350   ASSERT_TRUE(listener_->canceled()); | 
| 351   ASSERT_EQ(this, listener_->params()); | 351   ASSERT_EQ(this, listener_->params()); | 
| 352 } | 352 } | 
| OLD | NEW | 
|---|