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

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

Issue 1257603003: Revert of Add ExecuteJavaScriptForTest and make all tests use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
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/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 // that the window has closed. 205 // that the window has closed.
206 content::RenderViewHost* host = dialog_->GetRenderViewHost(); 206 content::RenderViewHost* host = dialog_->GetRenderViewHost();
207 std::string button_class = 207 std::string button_class =
208 (button_type == DIALOG_BTN_OK) ? ".button-panel .ok" : 208 (button_type == DIALOG_BTN_OK) ? ".button-panel .ok" :
209 ".button-panel .cancel"; 209 ".button-panel .cancel";
210 base::string16 script = base::ASCIIToUTF16( 210 base::string16 script = base::ASCIIToUTF16(
211 "console.log(\'Test JavaScript injected.\');" 211 "console.log(\'Test JavaScript injected.\');"
212 "document.querySelector(\'" + button_class + "\').click();"); 212 "document.querySelector(\'" + button_class + "\').click();");
213 // The file selection handler closes the dialog and does not return control 213 // The file selection handler closes the dialog and does not return control
214 // to JavaScript, so do not wait for return values. 214 // to JavaScript, so do not wait for return values.
215 host->GetMainFrame()->ExecuteJavaScriptForTests(script); 215 host->GetMainFrame()->ExecuteJavaScript(script);
216 LOG(INFO) << "Waiting for window close notification."; 216 LOG(INFO) << "Waiting for window close notification.";
217 listener_->WaitForCalled(); 217 listener_->WaitForCalled();
218 218
219 // Dialog no longer believes it is running. 219 // Dialog no longer believes it is running.
220 ASSERT_FALSE(dialog_->IsRunning(owning_window)); 220 ASSERT_FALSE(dialog_->IsRunning(owning_window));
221 } 221 }
222 222
223 scoped_ptr<MockSelectFileDialogListener> listener_; 223 scoped_ptr<MockSelectFileDialogListener> listener_;
224 scoped_refptr<SelectFileDialogExtension> dialog_; 224 scoped_refptr<SelectFileDialogExtension> dialog_;
225 225
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 ASSERT_FALSE(second_dialog_->IsRunning(owning_window)); 396 ASSERT_FALSE(second_dialog_->IsRunning(owning_window));
397 397
398 // Click cancel button. 398 // Click cancel button.
399 CloseDialog(DIALOG_BTN_CANCEL, owning_window); 399 CloseDialog(DIALOG_BTN_CANCEL, owning_window);
400 400
401 // Listener should have been informed of the cancellation. 401 // Listener should have been informed of the cancellation.
402 ASSERT_FALSE(listener_->file_selected()); 402 ASSERT_FALSE(listener_->file_selected());
403 ASSERT_TRUE(listener_->canceled()); 403 ASSERT_TRUE(listener_->canceled());
404 ASSERT_EQ(this, listener_->params()); 404 ASSERT_EQ(this, listener_->params());
405 } 405 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/browser_browsertest.cc ('k') | chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698