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

Unified Diff: chrome/browser/local_discovery/privet_http_unittest.cc

Issue 72033002: Added the ability to set the upload file path (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/local_discovery/privet_http_unittest.cc
diff --git a/chrome/browser/local_discovery/privet_http_unittest.cc b/chrome/browser/local_discovery/privet_http_unittest.cc
index f0fd19c5ee13f4272577706d07b5894a5aa7f172..cc4f6b8b3f68c86c552d202236a16a1c6dae5898 100644
--- a/chrome/browser/local_discovery/privet_http_unittest.cc
+++ b/chrome/browser/local_discovery/privet_http_unittest.cc
@@ -210,22 +210,11 @@ class PrivetHTTPTest : public ::testing::Test {
bool SuccessfulResponseToURL(const GURL& url,
const std::string& response) {
- return SuccessfulResponseToURLAndData(url, "", response);
- }
-
- bool SuccessfulResponseToURLAndData(const GURL& url,
- const std::string& data,
- const std::string& response) {
net::TestURLFetcher* fetcher = fetcher_factory_.GetFetcherByID(0);
EXPECT_TRUE(fetcher);
EXPECT_EQ(url, fetcher->GetOriginalURL());
- if (!data.empty()) {
- EXPECT_EQ(data, fetcher->upload_data());
- }
-
- if (!fetcher || url != fetcher->GetOriginalURL() ||
- (!data.empty() && data != fetcher->upload_data()))
+ if (!fetcher || url != fetcher->GetOriginalURL())
return false;
fetcher->SetResponseString(response);
@@ -236,6 +225,37 @@ class PrivetHTTPTest : public ::testing::Test {
return true;
}
+ bool SuccessfulResponseToURLAndData(const GURL& url,
+ const std::string& data,
+ const std::string& response) {
+ net::TestURLFetcher* fetcher = fetcher_factory_.GetFetcherByID(0);
+ EXPECT_TRUE(fetcher);
+ EXPECT_EQ(url, fetcher->GetOriginalURL());
+
+ if (!fetcher) return false;
+
+ EXPECT_EQ(data, fetcher->upload_data());
+ if (data != fetcher->upload_data()) return false;
+
+ return SuccessfulResponseToURL(url, response);
+ }
+
+ bool SuccessfulResponseToURLAndFilePath(const GURL& url,
+ const base::FilePath& file_path,
+ const std::string& response) {
+ net::TestURLFetcher* fetcher = fetcher_factory_.GetFetcherByID(0);
+ EXPECT_TRUE(fetcher);
+ EXPECT_EQ(url, fetcher->GetOriginalURL());
+
+ if (!fetcher) return false;
+
+ EXPECT_EQ(file_path, fetcher->upload_file_path());
+ if (file_path != fetcher->upload_file_path()) return false;
+
+ return SuccessfulResponseToURL(url, response);
+ }
+
+
void RunFor(base::TimeDelta time_period) {
base::CancelableCallback<void()> callback(base::Bind(
&PrivetHTTPTest::Stop, base::Unretained(this)));
@@ -835,15 +855,16 @@ TEST_F(PrivetLocalPrintTest, SuccessfulPWGLocalPrint) {
GURL("http://10.0.0.8:6006/privet/capabilities"),
kSampleCapabilitiesResponsePWGOnly));
- local_print_operation_->SendData("Sample print data");
+ local_print_operation_->SendDataFile(
+ base::FilePath(FILE_PATH_LITERAL("sample/file/path")));
EXPECT_CALL(local_print_delegate_, OnPrivetPrintingDoneInternal());
// TODO(noamsml): Is encoding spaces as pluses standard?
- EXPECT_TRUE(SuccessfulResponseToURLAndData(
+ EXPECT_TRUE(SuccessfulResponseToURLAndFilePath(
GURL("http://10.0.0.8:6006/privet/printer/submitdoc?"
"user=sample%40gmail.com&jobname=Sample+job+name"),
- "Sample print data",
+ base::FilePath(FILE_PATH_LITERAL("sample/file/path")),
kSampleLocalPrintResponse));
};
« no previous file with comments | « chrome/browser/local_discovery/privet_http_impl.cc ('k') | chrome/browser/local_discovery/privet_url_fetcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698