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

Side by Side Diff: chrome/browser/net/sdch_browsertest.cc

Issue 901303002: Make SDCH dictionaries persistent across browser restart. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix cache control headers Created 5 years, 9 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
« no previous file with comments | « DEPS ('k') | chrome/browser/profiles/profile_impl_io_data.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // End-to-end SDCH tests. Uses the embedded test server to return SDCH 5 // End-to-end SDCH tests. Uses the embedded test server to return SDCH
6 // results 6 // results
7 7
8 #include "base/base64.h" 8 #include "base/base64.h"
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 response->set_content(kSampleData); 210 response->set_content(kSampleData);
211 if (ClientIsAdvertisingSdchEncoding(request.headers)) 211 if (ClientIsAdvertisingSdchEncoding(request.headers))
212 response->AddCustomHeader("Get-Dictionary", kDictionaryURLPath); 212 response->AddCustomHeader("Get-Dictionary", kDictionaryURLPath);
213 // We never cache the plain data response, to make it 213 // We never cache the plain data response, to make it
214 // easy to refresh after we get the dictionary. 214 // easy to refresh after we get the dictionary.
215 response->AddCustomHeader("Cache-Control", "no-store"); 215 response->AddCustomHeader("Cache-Control", "no-store");
216 } 216 }
217 } else { 217 } else {
218 DCHECK_EQ(request.relative_url, kDictionaryURLPath); 218 DCHECK_EQ(request.relative_url, kDictionaryURLPath);
219 DCHECK_NE(sdch_dictionary_contents_, ""); 219 DCHECK_NE(sdch_dictionary_contents_, "");
220 response->AddCustomHeader("Cache-Control", "max-age=3600");
220 response->set_content_type("application/x-sdch-dictionary"); 221 response->set_content_type("application/x-sdch-dictionary");
221 response->set_content(sdch_dictionary_contents_); 222 response->set_content(sdch_dictionary_contents_);
222 } 223 }
223 std::vector<base::Closure> callbacks; 224 std::vector<base::Closure> callbacks;
224 callbacks.swap(callback_vector_); 225 callbacks.swap(callback_vector_);
225 for (std::vector<base::Closure>::iterator it = callbacks.begin(); 226 for (std::vector<base::Closure>::iterator it = callbacks.begin();
226 it != callbacks.end(); ++it) { 227 it != callbacks.end(); ++it) {
227 it->Run(); 228 it->Run();
228 } 229 }
229 return response.Pass(); 230 return response.Pass();
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
694 ASSERT_TRUE(SetupIncognitoBrowser()); 695 ASSERT_TRUE(SetupIncognitoBrowser());
695 ASSERT_TRUE(ForceSdchDictionaryLoad(incognito_browser())); 696 ASSERT_TRUE(ForceSdchDictionaryLoad(incognito_browser()));
696 697
697 // Data fetches on main browser should not be SDCH encoded. 698 // Data fetches on main browser should not be SDCH encoded.
698 bool sdch_encoding_used = true; 699 bool sdch_encoding_used = true;
699 ASSERT_TRUE(GetData(&sdch_encoding_used)); 700 ASSERT_TRUE(GetData(&sdch_encoding_used));
700 EXPECT_FALSE(sdch_encoding_used); 701 EXPECT_FALSE(sdch_encoding_used);
701 } 702 }
702 703
703 } // namespace 704 } // namespace
OLDNEW
« no previous file with comments | « DEPS ('k') | chrome/browser/profiles/profile_impl_io_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698