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

Side by Side Diff: content/browser/cross_site_transfer_browsertest.cc

Issue 2316043002: //content: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Just rebased Created 4 years, 3 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 <memory> 5 #include <memory>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 "a.com", "/form_that_posts_cross_site.html")); 439 "a.com", "/form_that_posts_cross_site.html"));
440 GURL redirect_target_url(embedded_test_server()->GetURL("x.com", "/echoall")); 440 GURL redirect_target_url(embedded_test_server()->GetURL("x.com", "/echoall"));
441 EXPECT_TRUE(NavigateToURL(shell(), form_url)); 441 EXPECT_TRUE(NavigateToURL(shell(), form_url));
442 442
443 // Prepare a file to upload. 443 // Prepare a file to upload.
444 base::ThreadRestrictions::ScopedAllowIO allow_io_for_temp_dir; 444 base::ThreadRestrictions::ScopedAllowIO allow_io_for_temp_dir;
445 base::ScopedTempDir temp_dir; 445 base::ScopedTempDir temp_dir;
446 base::FilePath file_path; 446 base::FilePath file_path;
447 std::string file_content("test-file-content"); 447 std::string file_content("test-file-content");
448 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 448 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
449 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir.path(), &file_path)); 449 ASSERT_TRUE(base::CreateTemporaryFileInDir(temp_dir.GetPath(), &file_path));
450 ASSERT_LT( 450 ASSERT_LT(
451 0, base::WriteFile(file_path, file_content.data(), file_content.size())); 451 0, base::WriteFile(file_path, file_content.data(), file_content.size()));
452 452
453 // Fill out the form to refer to the test file. 453 // Fill out the form to refer to the test file.
454 std::unique_ptr<FileChooserDelegate> delegate( 454 std::unique_ptr<FileChooserDelegate> delegate(
455 new FileChooserDelegate(file_path)); 455 new FileChooserDelegate(file_path));
456 shell()->web_contents()->SetDelegate(delegate.get()); 456 shell()->web_contents()->SetDelegate(delegate.get());
457 EXPECT_TRUE(ExecuteScript(shell()->web_contents(), 457 EXPECT_TRUE(ExecuteScript(shell()->web_contents(),
458 "document.getElementById('file').click();")); 458 "document.getElementById('file').click();"));
459 EXPECT_TRUE(delegate->file_chosen()); 459 EXPECT_TRUE(delegate->file_chosen());
(...skipping 29 matching lines...) Expand all
489 "document.getElementsByTagName('pre')[0].innerText);", 489 "document.getElementsByTagName('pre')[0].innerText);",
490 &actual_page_body)); 490 &actual_page_body));
491 EXPECT_THAT(actual_page_body, ::testing::HasSubstr(file_content)); 491 EXPECT_THAT(actual_page_body, ::testing::HasSubstr(file_content));
492 EXPECT_THAT(actual_page_body, 492 EXPECT_THAT(actual_page_body,
493 ::testing::HasSubstr(file_path.BaseName().AsUTF8Unsafe())); 493 ::testing::HasSubstr(file_path.BaseName().AsUTF8Unsafe()));
494 EXPECT_THAT(actual_page_body, 494 EXPECT_THAT(actual_page_body,
495 ::testing::HasSubstr("form-data; name=\"file\"")); 495 ::testing::HasSubstr("form-data; name=\"file\""));
496 } 496 }
497 497
498 } // namespace content 498 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/cache_storage/cache_storage_manager_unittest.cc ('k') | content/browser/database_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698