Permalink
Browse files

backport various changes to make #1050 work

  • Loading branch information...
crowell committed May 14, 2015
1 parent 741a865 commit 3ac0192ab8e383ddcd8f77ead391482a75accb48
@@ -749,22 +749,25 @@ TEST_F(ProxyInterfaceTest, PassThroughEmptyResource) {
ResponseHeaders response_headers;
FetchFromProxy("text.txt", true, &text, &response_headers);
EXPECT_EQ(kContent, text);
// HTTP resource not found the first time.
EXPECT_EQ(1, http_cache()->cache_misses()->Get());
EXPECT_EQ(0, http_cache()->cache_hits()->Get());
// One lookup for ajax metadata and one for the HTTP response. Neither are
// found.
EXPECT_EQ(2, lru_cache()->num_misses());
EXPECT_EQ(1, http_cache()->cache_misses()->Get());
EXPECT_EQ(0, lru_cache()->num_hits());

ClearStats();
GoogleString text2;
ResponseHeaders response_headers2;
FetchFromProxy("text.txt", true, &text2, &response_headers2);
EXPECT_EQ(kContent, text2);
// The HTTP response is found but the ajax metadata is not found.
EXPECT_EQ(1, lru_cache()->num_hits());
EXPECT_EQ(1, http_cache()->cache_hits()->Get());
EXPECT_EQ(1, lru_cache()->num_misses());
EXPECT_EQ(0, http_cache()->cache_misses()->Get());
// Empty resources are not remembered in this flow, so stats are exactly the
// same on second load.
EXPECT_EQ(1, http_cache()->cache_misses()->Get());
EXPECT_EQ(0, http_cache()->cache_hits()->Get());
EXPECT_EQ(2, lru_cache()->num_misses());
EXPECT_EQ(0, lru_cache()->num_hits());
}

TEST_F(ProxyInterfaceTest, SetCookieNotCached) {
@@ -605,7 +605,7 @@ TEST_F(CssFlattenImportsTest, DontFlattenOverTinyLimit) {
TEST_F(CssFlattenImportsTest, FlattenEmpty) {
// We intentionally do not inline any empty resources.
const char kFilename[] = "empty.css";
const char css_in[] = "@import url(http://test.com/empty.css);";
const char css_in[] = "@import url(http://test.com/empty.css) ;";
const char empty_content[] = "";

SetResponseWithDefaultHeaders(kFilename, kContentTypeCss, empty_content, 100);
@@ -84,12 +84,8 @@ bool InlineRewriteContext::Partition(OutputPartitions* partitions,

bool ok = false;
GoogleString reason_for_failure;
if (!resource->IsSafeToRewrite(rewrite_uncacheable())) {
if (!resource->IsSafeToRewrite(rewrite_uncacheable(), &reason_for_failure)) {
AddRecheckDependency();
// TODO(morlovich): Follow up by integrating with jmaessen's instrumentation
// of IsSafeToRewrite?
reason_for_failure =
"Can't inline since resource not fetchable or cacheable";
} else {
resource->AddInputInfoToPartition(Resource::kOmitInputHash, 0, partition);
if (ShouldInline(resource, &reason_for_failure)) {

0 comments on commit 3ac0192

Please sign in to comment.