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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 2046593003: Fix Document::firstPartyForCookies() for OOPIFs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use the top frame in the remote case and add a test Created 4 years, 6 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 | « third_party/WebKit/Source/platform/weborigin/SchemeRegistry.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 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 8090 matching lines...) Expand 10 before | Expand all | Expand 10 after
8101 8101
8102 // Finally, make sure an embedder triggered load in the local frame swapped 8102 // Finally, make sure an embedder triggered load in the local frame swapped
8103 // back in works. 8103 // back in works.
8104 registerMockedHttpURLLoad("send_beacon.html"); 8104 registerMockedHttpURLLoad("send_beacon.html");
8105 registerMockedHttpURLLoad("reload_post.html"); // url param to sendBeacon() 8105 registerMockedHttpURLLoad("reload_post.html"); // url param to sendBeacon()
8106 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "send_beacon.html"); 8106 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "send_beacon.html");
8107 8107
8108 view->close(); 8108 view->close();
8109 } 8109 }
8110 8110
8111 TEST_P(ParameterizedWebFrameTest, FirstPartyForCookiesFromChildWithRemoteMainFra me)
8112 {
8113 FrameTestHelpers::TestWebViewClient viewClient;
8114 FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
8115 WebView* view = WebView::create(&viewClient);
8116 view->setMainFrame(remoteClient.frame());
8117 WebRemoteFrame* root = view->mainFrame()->toWebRemoteFrame();
8118 root->setReplicatedOrigin(SecurityOrigin::create(toKURL(m_notBaseURL)));
8119
8120 WebLocalFrame* localFrame = FrameTestHelpers::createLocalChild(root);
8121
8122 registerMockedHttpURLLoad("foo.html");
8123 FrameTestHelpers::loadFrame(localFrame, m_baseURL + "foo.html");
8124 EXPECT_EQ(WebURL(SecurityOrigin::urlWithUniqueSecurityOrigin()), localFrame- >document().firstPartyForCookies());
8125
8126 SchemeRegistry::registerURLSchemeAsFirstPartyWhenTopLevel("http");
8127 EXPECT_EQ(WebURL(toKURL(m_notBaseURL)), localFrame->document().firstPartyFor Cookies());
8128 SchemeRegistry::removeURLSchemeAsFirstPartyWhenTopLevel("http");
8129
8130 view->close();
8131 }
8132
8111 // See https://crbug.com/525285. 8133 // See https://crbug.com/525285.
8112 TEST_P(ParameterizedWebFrameTest, RemoteToLocalSwapOnMainFrameInitializesCoreFra me) 8134 TEST_P(ParameterizedWebFrameTest, RemoteToLocalSwapOnMainFrameInitializesCoreFra me)
8113 { 8135 {
8114 FrameTestHelpers::TestWebViewClient viewClient; 8136 FrameTestHelpers::TestWebViewClient viewClient;
8115 FrameTestHelpers::TestWebRemoteFrameClient remoteClient; 8137 FrameTestHelpers::TestWebRemoteFrameClient remoteClient;
8116 WebView* view = WebView::create(&viewClient); 8138 WebView* view = WebView::create(&viewClient);
8117 view->setMainFrame(remoteClient.frame()); 8139 view->setMainFrame(remoteClient.frame());
8118 WebRemoteFrame* remoteRoot = view->mainFrame()->toWebRemoteFrame(); 8140 WebRemoteFrame* remoteRoot = view->mainFrame()->toWebRemoteFrame();
8119 remoteRoot->setReplicatedOrigin(SecurityOrigin::createUnique()); 8141 remoteRoot->setReplicatedOrigin(SecurityOrigin::createUnique());
8120 8142
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after
8684 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame(); 8706 WebLocalFrame* mainFrame = helper.webView()->mainFrame()->toWebLocalFrame();
8685 v8::HandleScope scope(v8::Isolate::GetCurrent()); 8707 v8::HandleScope scope(v8::Isolate::GetCurrent());
8686 mainFrame->executeScript(WebScriptSource("hello = 'world';")); 8708 mainFrame->executeScript(WebScriptSource("hello = 'world';"));
8687 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page"); 8709 FrameTestHelpers::loadFrame(mainFrame, "data:text/html,new page");
8688 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri ptSource("hello")); 8710 v8::Local<v8::Value> result = mainFrame->executeScriptAndReturnValue(WebScri ptSource("hello"));
8689 ASSERT_TRUE(result->IsString()); 8711 ASSERT_TRUE(result->IsString());
8690 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC ontext()).ToLocalChecked())); 8712 EXPECT_EQ("world", toCoreString(result->ToString(mainFrame->mainWorldScriptC ontext()).ToLocalChecked()));
8691 } 8713 }
8692 8714
8693 } // namespace blink 8715 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/weborigin/SchemeRegistry.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698