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

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

Issue 105193002: Replace string16 with base::string16. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 <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/file_util.h" 10 #include "base/file_util.h"
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 if (type != SIZE_TEST_TYPE_KNOWN && type != SIZE_TEST_TYPE_UNKNOWN) 738 if (type != SIZE_TEST_TYPE_KNOWN && type != SIZE_TEST_TYPE_UNKNOWN)
739 return false; 739 return false;
740 GURL url(type == SIZE_TEST_TYPE_KNOWN ? 740 GURL url(type == SIZE_TEST_TYPE_KNOWN ?
741 URLRequestSlowDownloadJob::kKnownSizeUrl : 741 URLRequestSlowDownloadJob::kKnownSizeUrl :
742 URLRequestSlowDownloadJob::kUnknownSizeUrl); 742 URLRequestSlowDownloadJob::kUnknownSizeUrl);
743 743
744 // TODO(ahendrickson) -- |expected_title_in_progress| and 744 // TODO(ahendrickson) -- |expected_title_in_progress| and
745 // |expected_title_finished| need to be checked. 745 // |expected_title_finished| need to be checked.
746 base::FilePath filename; 746 base::FilePath filename;
747 net::FileURLToFilePath(url, &filename); 747 net::FileURLToFilePath(url, &filename);
748 string16 expected_title_in_progress( 748 base::string16 expected_title_in_progress(
749 ASCIIToUTF16(partial_indication) + filename.LossyDisplayName()); 749 ASCIIToUTF16(partial_indication) + filename.LossyDisplayName());
750 string16 expected_title_finished( 750 base::string16 expected_title_finished(
751 ASCIIToUTF16(total_indication) + filename.LossyDisplayName()); 751 ASCIIToUTF16(total_indication) + filename.LossyDisplayName());
752 752
753 // Download a partial web page in a background tab and wait. 753 // Download a partial web page in a background tab and wait.
754 // The mock system will not complete until it gets a special URL. 754 // The mock system will not complete until it gets a special URL.
755 scoped_ptr<content::DownloadTestObserver> observer( 755 scoped_ptr<content::DownloadTestObserver> observer(
756 CreateWaiter(browser, 1)); 756 CreateWaiter(browser, 1));
757 ui_test_utils::NavigateToURL(browser, url); 757 ui_test_utils::NavigateToURL(browser, url);
758 758
759 // TODO(ahendrickson): check download status text before downloading. 759 // TODO(ahendrickson): check download status text before downloading.
760 // Need to: 760 // Need to:
(...skipping 1614 matching lines...) Expand 10 before | Expand all | Expand 10 after
2375 WebContents* web_contents = 2375 WebContents* web_contents =
2376 browser()->tab_strip_model()->GetActiveWebContents(); 2376 browser()->tab_strip_model()->GetActiveWebContents();
2377 ASSERT_TRUE(web_contents != NULL); 2377 ASSERT_TRUE(web_contents != NULL);
2378 content::WindowedNotificationObserver observer( 2378 content::WindowedNotificationObserver observer(
2379 content::NOTIFICATION_NAV_ENTRY_COMMITTED, 2379 content::NOTIFICATION_NAV_ENTRY_COMMITTED,
2380 content::Source<content::NavigationController>( 2380 content::Source<content::NavigationController>(
2381 &web_contents->GetController())); 2381 &web_contents->GetController()));
2382 content::RenderViewHost* render_view_host = web_contents->GetRenderViewHost(); 2382 content::RenderViewHost* render_view_host = web_contents->GetRenderViewHost();
2383 ASSERT_TRUE(render_view_host != NULL); 2383 ASSERT_TRUE(render_view_host != NULL);
2384 render_view_host->ExecuteJavascriptInWebFrame( 2384 render_view_host->ExecuteJavascriptInWebFrame(
2385 string16(), ASCIIToUTF16("SubmitForm()")); 2385 base::string16(), ASCIIToUTF16("SubmitForm()"));
2386 observer.Wait(); 2386 observer.Wait();
2387 EXPECT_EQ(jpeg_url, web_contents->GetURL()); 2387 EXPECT_EQ(jpeg_url, web_contents->GetURL());
2388 2388
2389 // Stop the test server, and then try to save the page. If cache validation 2389 // Stop the test server, and then try to save the page. If cache validation
2390 // is not bypassed then this will fail since the server is no longer 2390 // is not bypassed then this will fail since the server is no longer
2391 // reachable. This will also fail if it tries to be retrieved via "GET" 2391 // reachable. This will also fail if it tries to be retrieved via "GET"
2392 // rather than "POST". 2392 // rather than "POST".
2393 ASSERT_TRUE(test_server()->Stop()); 2393 ASSERT_TRUE(test_server()->Stop());
2394 scoped_ptr<content::DownloadTestObserver> waiter( 2394 scoped_ptr<content::DownloadTestObserver> waiter(
2395 new content::DownloadTestObserverTerminal( 2395 new content::DownloadTestObserverTerminal(
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
2890 L"This is a very very long english sentence with spaces and , and +.zip", 2890 L"This is a very very long english sentence with spaces and , and +.zip",
2891 }; 2891 };
2892 2892
2893 std::vector<DownloadItem*> download_items; 2893 std::vector<DownloadItem*> download_items;
2894 static const int kFlags = (base::PLATFORM_FILE_CREATE | 2894 static const int kFlags = (base::PLATFORM_FILE_CREATE |
2895 base::PLATFORM_FILE_WRITE); 2895 base::PLATFORM_FILE_WRITE);
2896 base::FilePath origin(FILE_PATH_LITERAL("origin")); 2896 base::FilePath origin(FILE_PATH_LITERAL("origin"));
2897 ASSERT_TRUE(base::CreateDirectory(DestinationFile(browser(), origin))); 2897 ASSERT_TRUE(base::CreateDirectory(DestinationFile(browser(), origin)));
2898 2898
2899 for (size_t index = 0; index < arraysize(kCrazyFilenames); ++index) { 2899 for (size_t index = 0; index < arraysize(kCrazyFilenames); ++index) {
2900 string16 crazy16; 2900 base::string16 crazy16;
2901 std::string crazy8; 2901 std::string crazy8;
2902 const wchar_t* crazy_w = kCrazyFilenames[index]; 2902 const wchar_t* crazy_w = kCrazyFilenames[index];
2903 ASSERT_TRUE(WideToUTF8(crazy_w, wcslen(crazy_w), &crazy8)); 2903 ASSERT_TRUE(WideToUTF8(crazy_w, wcslen(crazy_w), &crazy8));
2904 ASSERT_TRUE(WideToUTF16(crazy_w, wcslen(crazy_w), &crazy16)); 2904 ASSERT_TRUE(WideToUTF16(crazy_w, wcslen(crazy_w), &crazy16));
2905 base::FilePath file_path(DestinationFile(browser(), origin.Append( 2905 base::FilePath file_path(DestinationFile(browser(), origin.Append(
2906 #if defined(OS_WIN) 2906 #if defined(OS_WIN)
2907 crazy16 2907 crazy16
2908 #elif defined(OS_POSIX) 2908 #elif defined(OS_POSIX)
2909 crazy8 2909 crazy8
2910 #endif 2910 #endif
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after
3250 3250
3251 // No errors this time. The download should complete successfully. 3251 // No errors this time. The download should complete successfully.
3252 EXPECT_FALSE(completion_observer->IsFinished()); 3252 EXPECT_FALSE(completion_observer->IsFinished());
3253 completion_observer->StartObserving(); 3253 completion_observer->StartObserving();
3254 download->Resume(); 3254 download->Resume();
3255 completion_observer->WaitForFinished(); 3255 completion_observer->WaitForFinished();
3256 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); 3256 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState());
3257 3257
3258 EXPECT_FALSE(DidShowFileChooser()); 3258 EXPECT_FALSE(DidShowFileChooser());
3259 } 3259 }
OLDNEW
« no previous file with comments | « chrome/browser/do_not_track_browsertest.cc ('k') | chrome/browser/download/download_danger_prompt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698