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

Side by Side Diff: content/browser/site_per_process_browsertest.cc

Issue 2371993003: Throw when blocking top-level navigation. (Closed)
Patch Set: Test. Created 4 years, 2 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/site_per_process_browsertest.h" 5 #include "content/browser/site_per_process_browsertest.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 3751 matching lines...) Expand 10 before | Expand all | Expand 10 after
3762 // frame. This should fail with a console error message, which should 3762 // frame. This should fail with a console error message, which should
3763 // contain the second frame's updated origin (see blink::Frame::canNavigate). 3763 // contain the second frame's updated origin (see blink::Frame::canNavigate).
3764 std::unique_ptr<ConsoleObserverDelegate> console_delegate( 3764 std::unique_ptr<ConsoleObserverDelegate> console_delegate(
3765 new ConsoleObserverDelegate( 3765 new ConsoleObserverDelegate(
3766 shell()->web_contents(), 3766 shell()->web_contents(),
3767 "Unsafe JavaScript attempt to initiate navigation*")); 3767 "Unsafe JavaScript attempt to initiate navigation*"));
3768 shell()->web_contents()->SetDelegate(console_delegate.get()); 3768 shell()->web_contents()->SetDelegate(console_delegate.get());
3769 3769
3770 // frames[1] can't be used due to a bug where RemoteFrames are created out of 3770 // frames[1] can't be used due to a bug where RemoteFrames are created out of
3771 // order (https://crbug.com/478792). Instead, target second frame by name. 3771 // order (https://crbug.com/478792). Instead, target second frame by name.
3772 EXPECT_TRUE(ExecuteScript( 3772 EXPECT_TRUE(ExecuteScript(root->child_at(0),
3773 root->child_at(0), 3773 "try { parent.frames['frame2'].location.href = "
3774 "parent.frames['frame2'].location.href = 'data:text/html,foo'")); 3774 "'data:text/html,foo'; } catch (e) {}"));
3775 console_delegate->Wait(); 3775 console_delegate->Wait();
3776 3776
3777 std::string frame_origin = root->child_at(1)->current_origin().Serialize(); 3777 std::string frame_origin = root->child_at(1)->current_origin().Serialize();
3778 EXPECT_EQ(frame_origin + "/", frame_url.GetOrigin().spec()); 3778 EXPECT_EQ(frame_origin + "/", frame_url.GetOrigin().spec());
3779 EXPECT_TRUE( 3779 EXPECT_TRUE(
3780 base::MatchPattern(console_delegate->message(), "*" + frame_origin + "*")) 3780 base::MatchPattern(console_delegate->message(), "*" + frame_origin + "*"))
3781 << "Error message does not contain the frame's latest origin (" 3781 << "Error message does not contain the frame's latest origin ("
3782 << frame_origin << ")"; 3782 << frame_origin << ")";
3783 } 3783 }
3784 3784
(...skipping 4439 matching lines...) Expand 10 before | Expand all | Expand 10 after
8224 " Site A ------------ proxies for B C\n" 8224 " Site A ------------ proxies for B C\n"
8225 " +--Site B ------- proxies for A C\n" 8225 " +--Site B ------- proxies for A C\n"
8226 " +--Site C -- proxies for A B\n" 8226 " +--Site C -- proxies for A B\n"
8227 "Where A = http://a.com/\n" 8227 "Where A = http://a.com/\n"
8228 " B = http://b.com/\n" 8228 " B = http://b.com/\n"
8229 " C = http://c.com/", 8229 " C = http://c.com/",
8230 DepictFrameTree(root)); 8230 DepictFrameTree(root));
8231 } 8231 }
8232 8232
8233 } // namespace content 8233 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698