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

Side by Side Diff: chrome/browser/extensions/api/downloads/downloads_api_unittest.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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 | 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 <algorithm> 5 #include <algorithm>
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 fs_(BrowserContext::GetDefaultStoragePartition(profile_)-> 730 fs_(BrowserContext::GetDefaultStoragePartition(profile_)->
731 GetFileSystemContext()) { 731 GetFileSystemContext()) {
732 CHECK(profile_); 732 CHECK(profile_);
733 CHECK(events_listener_); 733 CHECK(events_listener_);
734 CHECK(fs_); 734 CHECK(fs_);
735 } 735 }
736 736
737 ~HTML5FileWriter() { 737 ~HTML5FileWriter() {
738 CHECK(BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind( 738 CHECK(BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind(
739 &HTML5FileWriter::TearDownURLRequestContext, base::Unretained(this)))); 739 &HTML5FileWriter::TearDownURLRequestContext, base::Unretained(this))));
740 events_listener_->WaitFor(profile_, kURLRequestContextToreDown, ""); 740 events_listener_->WaitFor(
741 profile_, kURLRequestContextToreDown, std::string());
741 } 742 }
742 743
743 bool WriteFile() { 744 bool WriteFile() {
744 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 745 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
745 fs_->OpenFileSystem( 746 fs_->OpenFileSystem(
746 GURL(origin_), 747 GURL(origin_),
747 fileapi::kFileSystemTypeTemporary, 748 fileapi::kFileSystemTypeTemporary,
748 kCreateFileSystem, 749 kCreateFileSystem,
749 base::Bind(&HTML5FileWriter::OpenFileSystemCallback, 750 base::Bind(&HTML5FileWriter::OpenFileSystemCallback,
750 base::Unretained(this))); 751 base::Unretained(this)));
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1064 // Let cleanup complete on the FILE thread. 1065 // Let cleanup complete on the FILE thread.
1065 content::RunAllPendingInMessageLoop(BrowserThread::FILE); 1066 content::RunAllPendingInMessageLoop(BrowserThread::FILE);
1066 // Check the path passed to the icon extractor post-cancellation. 1067 // Check the path passed to the icon extractor post-cancellation.
1067 EXPECT_TRUE(RunFunctionAndReturnString(MockedGetFileIconFunction( 1068 EXPECT_TRUE(RunFunctionAndReturnString(MockedGetFileIconFunction(
1068 download_item->GetTargetFilePath(), IconLoader::NORMAL, "foo"), 1069 download_item->GetTargetFilePath(), IconLoader::NORMAL, "foo"),
1069 args32, 1070 args32,
1070 &result_string)); 1071 &result_string));
1071 1072
1072 // Simulate an error during icon load by invoking the mock with an empty 1073 // Simulate an error during icon load by invoking the mock with an empty
1073 // result string. 1074 // result string.
1074 std::string error = RunFunctionAndReturnError(MockedGetFileIconFunction( 1075 std::string error = RunFunctionAndReturnError(
1075 download_item->GetTargetFilePath(), IconLoader::NORMAL, ""), 1076 MockedGetFileIconFunction(download_item->GetTargetFilePath(),
1077 IconLoader::NORMAL,
1078 std::string()),
1076 args32); 1079 args32);
1077 EXPECT_STREQ(download_extension_errors::kIconNotFoundError, error.c_str()); 1080 EXPECT_STREQ(download_extension_errors::kIconNotFoundError, error.c_str());
1078 1081
1079 // Once the download item is deleted, we should return kInvalidOperationError. 1082 // Once the download item is deleted, we should return kInvalidOperationError.
1080 int id = download_item->GetId(); 1083 int id = download_item->GetId();
1081 download_item->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD); 1084 download_item->Delete(DownloadItem::DELETE_DUE_TO_USER_DISCARD);
1082 download_item = NULL; 1085 download_item = NULL;
1083 EXPECT_EQ(static_cast<DownloadItem*>(NULL), 1086 EXPECT_EQ(static_cast<DownloadItem*>(NULL),
1084 GetCurrentManager()->GetDownload(id)); 1087 GetCurrentManager()->GetDownload(id));
1085 error = RunFunctionAndReturnError(new DownloadsGetFileIconFunction(), args32); 1088 error = RunFunctionAndReturnError(new DownloadsGetFileIconFunction(), args32);
(...skipping 2161 matching lines...) Expand 10 before | Expand all | Expand 10 after
3247 " \"state\": {" 3250 " \"state\": {"
3248 " \"previous\": \"in_progress\"," 3251 " \"previous\": \"in_progress\","
3249 " \"current\": \"complete\"}}]", 3252 " \"current\": \"complete\"}}]",
3250 item->GetId(), 3253 item->GetId(),
3251 GetFilename("42.txt.crdownload").c_str(), 3254 GetFilename("42.txt.crdownload").c_str(),
3252 GetFilename("42.txt").c_str()))); 3255 GetFilename("42.txt").c_str())));
3253 } 3256 }
3254 3257
3255 // TODO(benjhayden) Figure out why DisableExtension() does not fire 3258 // TODO(benjhayden) Figure out why DisableExtension() does not fire
3256 // OnListenerRemoved. 3259 // OnListenerRemoved.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698