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

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: android 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 2426 matching lines...) Expand 10 before | Expand all | Expand 10 after
2437 ASSERT_TRUE(jpeg_url.is_valid()); 2437 ASSERT_TRUE(jpeg_url.is_valid());
2438 WebContents* web_contents = 2438 WebContents* web_contents =
2439 browser()->tab_strip_model()->GetActiveWebContents(); 2439 browser()->tab_strip_model()->GetActiveWebContents();
2440 ASSERT_TRUE(web_contents != NULL); 2440 ASSERT_TRUE(web_contents != NULL);
2441 content::WindowedNotificationObserver observer( 2441 content::WindowedNotificationObserver observer(
2442 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 2442 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
2443 content::Source<content::NavigationController>( 2443 content::Source<content::NavigationController>(
2444 &web_contents->GetController())); 2444 &web_contents->GetController()));
2445 content::RenderFrameHost* render_frame_host = web_contents->GetMainFrame(); 2445 content::RenderFrameHost* render_frame_host = web_contents->GetMainFrame();
2446 ASSERT_TRUE(render_frame_host != NULL); 2446 ASSERT_TRUE(render_frame_host != NULL);
2447 render_frame_host->ExecuteJavaScript(base::ASCIIToUTF16("SubmitForm()")); 2447 render_frame_host->ExecuteJavaScriptForTests(
2448 base::ASCIIToUTF16("SubmitForm()"));
2448 observer.Wait(); 2449 observer.Wait();
2449 EXPECT_EQ(jpeg_url, web_contents->GetURL()); 2450 EXPECT_EQ(jpeg_url, web_contents->GetURL());
2450 2451
2451 // Stop the test server, and then try to save the page. If cache validation 2452 // Stop the test server, and then try to save the page. If cache validation
2452 // is not bypassed then this will fail since the server is no longer 2453 // is not bypassed then this will fail since the server is no longer
2453 // reachable. This will also fail if it tries to be retrieved via "GET" 2454 // reachable. This will also fail if it tries to be retrieved via "GET"
2454 // rather than "POST". 2455 // rather than "POST".
2455 ASSERT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete()); 2456 ASSERT_TRUE(embedded_test_server()->ShutdownAndWaitUntilComplete());
2456 scoped_ptr<content::DownloadTestObserver> waiter( 2457 scoped_ptr<content::DownloadTestObserver> waiter(
2457 new content::DownloadTestObserverTerminal( 2458 new content::DownloadTestObserverTerminal(
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after
3662 *(downloads[0]))); 3663 *(downloads[0])));
3663 3664
3664 // Begin feedback and check that the file is "stolen". 3665 // Begin feedback and check that the file is "stolen".
3665 download_protection_service->feedback_service()->BeginFeedbackForDownload( 3666 download_protection_service->feedback_service()->BeginFeedbackForDownload(
3666 downloads[0]); 3667 downloads[0]);
3667 std::vector<DownloadItem*> updated_downloads; 3668 std::vector<DownloadItem*> updated_downloads;
3668 GetDownloads(browser(), &updated_downloads); 3669 GetDownloads(browser(), &updated_downloads);
3669 ASSERT_TRUE(updated_downloads.empty()); 3670 ASSERT_TRUE(updated_downloads.empty());
3670 } 3671 }
3671 #endif 3672 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698