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

Side by Side Diff: content/browser/service_worker/service_worker_browsertest.cc

Issue 1905873002: Add content_browsertests for testing cache control flags (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review #13 Created 4 years, 7 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
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 #include <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 // Tests that when data saver is enabled and a cross-origin fetch by a webpage 1161 // Tests that when data saver is enabled and a cross-origin fetch by a webpage
1162 // is intercepted by a serviceworker, and the serviceworker does a fetch, the 1162 // is intercepted by a serviceworker, and the serviceworker does a fetch, the
1163 // preflight request does not have save-data in Access-Control-Request-Headers. 1163 // preflight request does not have save-data in Access-Control-Request-Headers.
1164 IN_PROC_BROWSER_TEST_F(ServiceWorkerBrowserTest, CrossOriginFetchWithSaveData) { 1164 IN_PROC_BROWSER_TEST_F(ServiceWorkerBrowserTest, CrossOriginFetchWithSaveData) {
1165 const char kPageUrl[] = "/service_worker/fetch_cross_origin.html"; 1165 const char kPageUrl[] = "/service_worker/fetch_cross_origin.html";
1166 const char kWorkerUrl[] = "/service_worker/fetch_event_pass_through.js"; 1166 const char kWorkerUrl[] = "/service_worker/fetch_event_pass_through.js";
1167 net::EmbeddedTestServer cross_origin_server; 1167 net::EmbeddedTestServer cross_origin_server;
1168 cross_origin_server.ServeFilesFromSourceDirectory("content/test/data"); 1168 cross_origin_server.ServeFilesFromSourceDirectory("content/test/data");
1169 cross_origin_server.RegisterRequestHandler( 1169 cross_origin_server.RegisterRequestHandler(
1170 base::Bind(&VerifySaveDataNotInAccessControlRequestHeader)); 1170 base::Bind(&VerifySaveDataNotInAccessControlRequestHeader));
1171 cross_origin_server.Start(); 1171 ASSERT_TRUE(cross_origin_server.Start());
kinuko 2016/05/13 14:10:18 nit: this change looks fine but it's unrelated to
kinuko 2016/05/13 14:11:57 I see, you needed this because you added the warni
1172 1172
1173 MockContentBrowserClient content_browser_client; 1173 MockContentBrowserClient content_browser_client;
1174 content_browser_client.set_data_saver_enabled(true); 1174 content_browser_client.set_data_saver_enabled(true);
1175 ContentBrowserClient* old_client = 1175 ContentBrowserClient* old_client =
1176 SetBrowserClientForTesting(&content_browser_client); 1176 SetBrowserClientForTesting(&content_browser_client);
1177 shell()->web_contents()->GetRenderViewHost()->OnWebkitPreferencesChanged(); 1177 shell()->web_contents()->GetRenderViewHost()->OnWebkitPreferencesChanged();
1178 scoped_refptr<WorkerActivatedObserver> observer = 1178 scoped_refptr<WorkerActivatedObserver> observer =
1179 new WorkerActivatedObserver(wrapper()); 1179 new WorkerActivatedObserver(wrapper());
1180 observer->Init(); 1180 observer->Init();
1181 public_context()->RegisterServiceWorker( 1181 public_context()->RegisterServiceWorker(
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
1834 NavigateToTestPage(); 1834 NavigateToTestPage();
1835 // The V8 code cache must be stored to the CacheStorage which must be bigger 1835 // The V8 code cache must be stored to the CacheStorage which must be bigger
1836 // than 12 byte. 1836 // than 12 byte.
1837 EXPECT_GT(GetSideDataSize(), kV8CacheTimeStampDataSize); 1837 EXPECT_GT(GetSideDataSize(), kV8CacheTimeStampDataSize);
1838 1838
1839 NavigateToTestPage(); 1839 NavigateToTestPage();
1840 EXPECT_GT(GetSideDataSize(), kV8CacheTimeStampDataSize); 1840 EXPECT_GT(GetSideDataSize(), kV8CacheTimeStampDataSize);
1841 } 1841 }
1842 1842
1843 } // namespace content 1843 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698