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

Side by Side Diff: Source/web/tests/AssociatedURLLoaderTest.cpp

Issue 891263002: Prevent calling didReceiveData()/didFinishLoading() after didFailAccessControlCheck() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: More assert. Created 5 years, 10 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 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 WebURLLoaderOptions options; 548 WebURLLoaderOptions options;
549 options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPo licyUseAccessControl; 549 options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPo licyUseAccessControl;
550 m_expectedLoader = createAssociatedURLLoader(options); 550 m_expectedLoader = createAssociatedURLLoader(options);
551 EXPECT_TRUE(m_expectedLoader); 551 EXPECT_TRUE(m_expectedLoader);
552 m_expectedLoader->loadAsynchronously(request, this); 552 m_expectedLoader->loadAsynchronously(request, this);
553 553
554 serveRequests(); 554 serveRequests();
555 // We should get a notification about access control check failure. 555 // We should get a notification about access control check failure.
556 EXPECT_FALSE(m_willSendRequest); 556 EXPECT_FALSE(m_willSendRequest);
557 EXPECT_FALSE(m_didReceiveResponse); 557 EXPECT_FALSE(m_didReceiveResponse);
558 EXPECT_TRUE(m_didReceiveData); 558 EXPECT_FALSE(m_didReceiveData);
559 EXPECT_TRUE(m_didFail); 559 EXPECT_TRUE(m_didFail);
560 } 560 }
561 561
562 // Test that a cross origin redirect response with CORS headers that allow the r equesting origin succeeds. 562 // Test that a cross origin redirect response with CORS headers that allow the r equesting origin succeeds.
563 TEST_F(AssociatedURLLoaderTest, RedirectCrossOriginWithAccessControlSuccess) 563 TEST_F(AssociatedURLLoaderTest, RedirectCrossOriginWithAccessControlSuccess)
564 { 564 {
565 KURL url = toKURL("http://www.test.com/RedirectCrossOriginWithAccessControlS uccess.html"); 565 KURL url = toKURL("http://www.test.com/RedirectCrossOriginWithAccessControlS uccess.html");
566 char redirect[] = "http://www.other.com/RedirectCrossOriginWithAccessControl Success.html"; // Cross-origin 566 char redirect[] = "http://www.other.com/RedirectCrossOriginWithAccessControl Success.html"; // Cross-origin
567 KURL redirectURL = toKURL(redirect); 567 KURL redirectURL = toKURL(redirect);
568 568
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 m_expectedLoader->loadAsynchronously(request, this); 709 m_expectedLoader->loadAsynchronously(request, this);
710 serveRequests(); 710 serveRequests();
711 EXPECT_TRUE(m_didReceiveResponse); 711 EXPECT_TRUE(m_didReceiveResponse);
712 EXPECT_TRUE(m_didReceiveData); 712 EXPECT_TRUE(m_didReceiveData);
713 EXPECT_TRUE(m_didFinishLoading); 713 EXPECT_TRUE(m_didFinishLoading);
714 714
715 EXPECT_FALSE(m_actualResponse.httpHeaderField(headerNameString).isEmpty()); 715 EXPECT_FALSE(m_actualResponse.httpHeaderField(headerNameString).isEmpty());
716 } 716 }
717 717
718 } 718 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698