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

Side by Side Diff: third_party/WebKit/Source/core/loader/ThreadableLoaderTest.cpp

Issue 2250203003: Sync XHR on Worker should not crash when response arrives immediately (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fetch-data-loader-for-bytes-consumer
Patch Set: Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "core/loader/ThreadableLoader.h" 5 #include "core/loader/ThreadableLoader.h"
6 6
7 #include "core/dom/CrossThreadTask.h" 7 #include "core/dom/CrossThreadTask.h"
8 #include "core/fetch/MemoryCache.h" 8 #include "core/fetch/MemoryCache.h"
9 #include "core/fetch/ResourceLoaderOptions.h" 9 #include "core/fetch/ResourceLoaderOptions.h"
10 #include "core/loader/DocumentThreadableLoader.h" 10 #include "core/loader/DocumentThreadableLoader.h"
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
846 callCheckpoint(1); 846 callCheckpoint(1);
847 847
848 EXPECT_CALL(checkpoint(), Call(2)); 848 EXPECT_CALL(checkpoint(), Call(2));
849 EXPECT_CALL(*client(), didFailRedirectCheck()).WillOnce(InvokeWithoutArgs(th is, &ThreadableLoaderTest::clearLoader)); 849 EXPECT_CALL(*client(), didFailRedirectCheck()).WillOnce(InvokeWithoutArgs(th is, &ThreadableLoaderTest::clearLoader));
850 850
851 startLoader(redirectLoopURL()); 851 startLoader(redirectLoopURL());
852 callCheckpoint(2); 852 callCheckpoint(2);
853 serveRequests(); 853 serveRequests();
854 } 854 }
855 855
856 // This test case checks blink doesn't crash even when the response arrives
857 // synchronously.
858 TEST_P(ThreadableLoaderTest, GetResponseSynchronously)
859 {
860 InSequence s;
861 EXPECT_CALL(checkpoint(), Call(1));
862 createLoader(UseAccessControl);
863 callCheckpoint(1);
864
865 EXPECT_CALL(*client(), didFailAccessControlCheck(_));
866 EXPECT_CALL(checkpoint(), Call(2));
867
868 // Currently didFailAccessControlCheck is dispatched synchronously. This
869 // test is not saying that didFailAccessControlCheck should be dispatched
870 // synchronously, but is saying that even when a response is served
871 // synchronously it should not lead to a crash.
872 startLoader(KURL(KURL(), "about:blank"));
873 callCheckpoint(2);
874 }
875
856 } // namespace 876 } // namespace
857 877
858 } // namespace blink 878 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698