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

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

Issue 9600036: Move Render(View|Widget)Host and associated classes to content namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Respond to review comments. Created 8 years, 9 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"
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 165
166 } 166 }
167 167
168 void CloseDialog(DialogButtonType button_type, 168 void CloseDialog(DialogButtonType button_type,
169 const gfx::NativeWindow& owning_window) { 169 const gfx::NativeWindow& owning_window) {
170 // Inject JavaScript to click the cancel button and wait for notification 170 // Inject JavaScript to click the cancel button and wait for notification
171 // that the window has closed. 171 // that the window has closed.
172 ui_test_utils::WindowedNotificationObserver host_destroyed( 172 ui_test_utils::WindowedNotificationObserver host_destroyed(
173 content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, 173 content::NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED,
174 content::NotificationService::AllSources()); 174 content::NotificationService::AllSources());
175 RenderViewHost* host = dialog_->GetRenderViewHost(); 175 content::RenderViewHost* host = dialog_->GetRenderViewHost();
176 string16 main_frame; 176 string16 main_frame;
177 std::string button_class = 177 std::string button_class =
178 (button_type == DIALOG_BTN_OK) ? ".ok" : ".cancel"; 178 (button_type == DIALOG_BTN_OK) ? ".ok" : ".cancel";
179 string16 script = ASCIIToUTF16( 179 string16 script = ASCIIToUTF16(
180 "console.log(\'Test JavaScript injected.\');" 180 "console.log(\'Test JavaScript injected.\');"
181 "document.querySelector(\'" + button_class + "\').click();"); 181 "document.querySelector(\'" + button_class + "\').click();");
182 // The file selection handler closes the dialog and does not return control 182 // The file selection handler closes the dialog and does not return control
183 // to JavaScript, so do not wait for return values. 183 // to JavaScript, so do not wait for return values.
184 host->ExecuteJavascriptInWebFrame(main_frame, script); 184 host->ExecuteJavascriptInWebFrame(main_frame, script);
185 LOG(INFO) << "Waiting for window close notification."; 185 LOG(INFO) << "Waiting for window close notification.";
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 ASSERT_FALSE(second_dialog_->IsRunning(owning_window)); 362 ASSERT_FALSE(second_dialog_->IsRunning(owning_window));
363 363
364 // Click cancel button. 364 // Click cancel button.
365 CloseDialog(DIALOG_BTN_CANCEL, owning_window); 365 CloseDialog(DIALOG_BTN_CANCEL, owning_window);
366 366
367 // Listener should have been informed of the cancellation. 367 // Listener should have been informed of the cancellation.
368 ASSERT_FALSE(listener_->file_selected()); 368 ASSERT_FALSE(listener_->file_selected());
369 ASSERT_TRUE(listener_->canceled()); 369 ASSERT_TRUE(listener_->canceled());
370 ASSERT_EQ(this, listener_->params()); 370 ASSERT_EQ(this, listener_->params());
371 } 371 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698