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

Side by Side Diff: chrome/browser/download/download_browsertest.cc

Issue 1123783002: Add ExecuteJavaScriptForTest and make all tests use it (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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 <sstream> 5 #include <sstream>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file.h" 10 #include "base/files/file.h"
(...skipping 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after
2230 ASSERT_TRUE(jpeg_url.is_valid()); 2230 ASSERT_TRUE(jpeg_url.is_valid());
2231 WebContents* web_contents = 2231 WebContents* web_contents =
2232 browser()->tab_strip_model()->GetActiveWebContents(); 2232 browser()->tab_strip_model()->GetActiveWebContents();
2233 ASSERT_TRUE(web_contents != NULL); 2233 ASSERT_TRUE(web_contents != NULL);
2234 content::WindowedNotificationObserver observer( 2234 content::WindowedNotificationObserver observer(
2235 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 2235 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
2236 content::Source<content::NavigationController>( 2236 content::Source<content::NavigationController>(
2237 &web_contents->GetController())); 2237 &web_contents->GetController()));
2238 content::RenderFrameHost* render_frame_host = web_contents->GetMainFrame(); 2238 content::RenderFrameHost* render_frame_host = web_contents->GetMainFrame();
2239 ASSERT_TRUE(render_frame_host != NULL); 2239 ASSERT_TRUE(render_frame_host != NULL);
2240 render_frame_host->ExecuteJavaScript(base::ASCIIToUTF16("SubmitForm()")); 2240 render_frame_host->ExecuteJavaScriptForTests(
2241 base::ASCIIToUTF16("SubmitForm()"));
2241 observer.Wait(); 2242 observer.Wait();
2242 EXPECT_EQ(jpeg_url, web_contents->GetURL()); 2243 EXPECT_EQ(jpeg_url, web_contents->GetURL());
2243 2244
2244 // Stop the test server, and then try to save the page. If cache validation 2245 // Stop the test server, and then try to save the page. If cache validation
2245 // is not bypassed then this will fail since the server is no longer 2246 // is not bypassed then this will fail since the server is no longer
2246 // reachable. This will also fail if it tries to be retrieved via "GET" 2247 // reachable. This will also fail if it tries to be retrieved via "GET"
2247 // rather than "POST". 2248 // rather than "POST".
2248 ASSERT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); 2249 ASSERT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete());
2249 scoped_ptr<content::DownloadTestObserver> waiter( 2250 scoped_ptr<content::DownloadTestObserver> waiter(
2250 new content::DownloadTestObserverTerminal( 2251 new content::DownloadTestObserverTerminal(
(...skipping 1400 matching lines...) Expand 10 before | Expand all | Expand 10 after
3651 3652
3652 scoped_ptr<content::DownloadTestObserver> observer(DangerousDownloadWaiter( 3653 scoped_ptr<content::DownloadTestObserver> observer(DangerousDownloadWaiter(
3653 browser(), 1, content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); 3654 browser(), 1, content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY));
3654 ui_test_utils::NavigateToURL(browser(), extension_url); 3655 ui_test_utils::NavigateToURL(browser(), extension_url);
3655 3656
3656 observer->WaitForFinished(); 3657 observer->WaitForFinished();
3657 3658
3658 // Download shelf should close. 3659 // Download shelf should close.
3659 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible()); 3660 EXPECT_FALSE(browser()->window()->IsDownloadShelfVisible());
3660 } 3661 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/lock/screen_locker_tester.cc ('k') | chrome/browser/errorpage_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698