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

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

Issue 454623002: Send privet auth token in PrivetV3 mode instead of X-Privet token (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/local_discovery/privet_url_fetcher.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/local_discovery/privet_url_fetcher_unittest.cc
diff --git a/chrome/browser/local_discovery/privet_url_fetcher_unittest.cc b/chrome/browser/local_discovery/privet_url_fetcher_unittest.cc
index 1639419d324588483dac932b3ce750d8549e8f48..45d1edd5be73c13eec500298aa5bf91247310102 100644
--- a/chrome/browser/local_discovery/privet_url_fetcher_unittest.cc
+++ b/chrome/browser/local_discovery/privet_url_fetcher_unittest.cc
@@ -78,6 +78,8 @@ class MockPrivetURLFetcherDelegate : public PrivetURLFetcher::Delegate {
raw_mode_ = raw_mode;
}
+ std::string GetAuthToken() { return "MyAuthToken"; }
+
private:
scoped_ptr<base::DictionaryValue> saved_value_;
bool raw_mode_;
@@ -296,6 +298,23 @@ TEST_F(PrivetURLFetcherTest, FetcherToFile) {
fetcher->delegate()->OnURLFetchComplete(fetcher);
}
+TEST_F(PrivetURLFetcherTest, V3Mode) {
+ delegate_.SetRawMode(true);
+ privet_urlfetcher_->V3Mode();
+ privet_urlfetcher_->Start();
+ net::TestURLFetcher* fetcher = fetcher_factory_.GetFetcherByID(0);
+ ASSERT_TRUE(fetcher != NULL);
+ fetcher->SetResponseFilePath(
+ base::FilePath(FILE_PATH_LITERAL("sample/file")));
+ net::HttpRequestHeaders headers;
+ fetcher->GetExtraRequestHeaders(&headers);
+
+ std::string header_token;
+ ASSERT_FALSE(headers.GetHeader("X-Privet-Token", &header_token));
+ ASSERT_TRUE(headers.GetHeader("X-Privet-Auth", &header_token));
+ ASSERT_EQ("MyAuthToken", header_token);
+}
+
} // namespace
} // namespace local_discovery
« no previous file with comments | « chrome/browser/local_discovery/privet_url_fetcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698