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

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

Issue 316053007: Navigation transitions: Added notifyTransitionsShown and setupTransitionsView to WebLocalFrame (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review fix Created 6 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
« no previous file with comments | « Source/web/tests/WebDocumentTest.cpp ('k') | Source/web/tests/data/transition_exit.css » ('j') | 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 23 matching lines...) Expand all
34 34
35 #include "SkBitmap.h" 35 #include "SkBitmap.h"
36 #include "SkCanvas.h" 36 #include "SkCanvas.h"
37 #include "core/UserAgentStyleSheets.h" 37 #include "core/UserAgentStyleSheets.h"
38 #include "core/clipboard/DataTransfer.h" 38 #include "core/clipboard/DataTransfer.h"
39 #include "core/css/StyleSheetContents.h" 39 #include "core/css/StyleSheetContents.h"
40 #include "core/css/resolver/StyleResolver.h" 40 #include "core/css/resolver/StyleResolver.h"
41 #include "core/css/resolver/ViewportStyleResolver.h" 41 #include "core/css/resolver/ViewportStyleResolver.h"
42 #include "core/dom/DocumentMarkerController.h" 42 #include "core/dom/DocumentMarkerController.h"
43 #include "core/dom/FullscreenElementStack.h" 43 #include "core/dom/FullscreenElementStack.h"
44 #include "core/dom/NodeRenderStyle.h"
44 #include "core/dom/Range.h" 45 #include "core/dom/Range.h"
45 #include "core/editing/Editor.h" 46 #include "core/editing/Editor.h"
46 #include "core/editing/FrameSelection.h" 47 #include "core/editing/FrameSelection.h"
47 #include "core/editing/SpellChecker.h" 48 #include "core/editing/SpellChecker.h"
48 #include "core/editing/VisiblePosition.h" 49 #include "core/editing/VisiblePosition.h"
49 #include "core/events/MouseEvent.h" 50 #include "core/events/MouseEvent.h"
50 #include "core/frame/FrameView.h" 51 #include "core/frame/FrameView.h"
51 #include "core/frame/LocalFrame.h" 52 #include "core/frame/LocalFrame.h"
52 #include "core/frame/Settings.h" 53 #include "core/frame/Settings.h"
53 #include "core/html/HTMLDocument.h" 54 #include "core/html/HTMLDocument.h"
(...skipping 4277 matching lines...) Expand 10 before | Expand all | Expand 10 after
4331 TEST_F(WebFrameTest, MoveCaretSelectionTowardsWindowPointWithNoSelection) 4332 TEST_F(WebFrameTest, MoveCaretSelectionTowardsWindowPointWithNoSelection)
4332 { 4333 {
4333 FrameTestHelpers::WebViewHelper webViewHelper; 4334 FrameTestHelpers::WebViewHelper webViewHelper;
4334 webViewHelper.initializeAndLoad("about:blank", true); 4335 webViewHelper.initializeAndLoad("about:blank", true);
4335 WebFrame* frame = webViewHelper.webView()->mainFrame(); 4336 WebFrame* frame = webViewHelper.webView()->mainFrame();
4336 4337
4337 // This test passes if this doesn't crash. 4338 // This test passes if this doesn't crash.
4338 frame->moveCaretSelection(WebPoint(0, 0)); 4339 frame->moveCaretSelection(WebPoint(0, 0));
4339 } 4340 }
4340 4341
4342 TEST_F(WebFrameTest, NavigateToSandboxedMarkup)
4343 {
4344 FrameTestHelpers::WebViewHelper webViewHelper;
4345 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad("about:blank", tr ue);
4346 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewHelper.webView()->main Frame());
4347
4348 frame->document().setIsTransitionDocument();
4349
4350 std::string markup("<div id='foo'></div><script>document.getElementById('foo ').setAttribute('dir', 'rtl')</script>");
4351 frame->navigateToSandboxedMarkup(WebData(markup.data(), markup.length()));
4352 FrameTestHelpers::runPendingTasks();
4353
4354 WebDocument document = webViewImpl->mainFrame()->document();
4355 WebElement transitionElement = document.getElementById("foo");
4356 // Check that the markup got navigated to successfully.
4357 EXPECT_FALSE(transitionElement.isNull());
4358
4359 // Check that the inline script was not executed.
4360 EXPECT_FALSE(transitionElement.hasAttribute("dir"));
4361 }
4362
4341 class SpellCheckClient : public WebSpellCheckClient { 4363 class SpellCheckClient : public WebSpellCheckClient {
4342 public: 4364 public:
4343 explicit SpellCheckClient(uint32_t hash = 0) : m_numberOfTimesChecked(0), m_ hash(hash) { } 4365 explicit SpellCheckClient(uint32_t hash = 0) : m_numberOfTimesChecked(0), m_ hash(hash) { }
4344 virtual ~SpellCheckClient() { } 4366 virtual ~SpellCheckClient() { }
4345 virtual void requestCheckingOfText(const blink::WebString&, const blink::Web Vector<uint32_t>&, const blink::WebVector<unsigned>&, blink::WebTextCheckingComp letion* completion) OVERRIDE 4367 virtual void requestCheckingOfText(const blink::WebString&, const blink::Web Vector<uint32_t>&, const blink::WebVector<unsigned>&, blink::WebTextCheckingComp letion* completion) OVERRIDE
4346 { 4368 {
4347 ++m_numberOfTimesChecked; 4369 ++m_numberOfTimesChecked;
4348 Vector<WebTextCheckingResult> results; 4370 Vector<WebTextCheckingResult> results;
4349 const int misspellingStartOffset = 1; 4371 const int misspellingStartOffset = 1;
4350 const int misspellingLength = 8; 4372 const int misspellingLength = 8;
(...skipping 1570 matching lines...) Expand 10 before | Expand all | Expand 10 after
5921 5943
5922 client.reset(); 5944 client.reset();
5923 // Try to load the request with cross origin access. Should succeed. 5945 // Try to load the request with cross origin access. Should succeed.
5924 options.crossOriginRequestPolicy = blink::AllowCrossOriginRequests; 5946 options.crossOriginRequestPolicy = blink::AllowCrossOriginRequests;
5925 blink::DocumentThreadableLoader::loadResourceSynchronously( 5947 blink::DocumentThreadableLoader::loadResourceSynchronously(
5926 *frame->document(), blink::ResourceRequest(resourceUrl), client, options , resourceLoaderOptions); 5948 *frame->document(), blink::ResourceRequest(resourceUrl), client, options , resourceLoaderOptions);
5927 EXPECT_FALSE(client.failed()); 5949 EXPECT_FALSE(client.failed());
5928 } 5950 }
5929 5951
5930 } // namespace 5952 } // namespace
OLDNEW
« no previous file with comments | « Source/web/tests/WebDocumentTest.cpp ('k') | Source/web/tests/data/transition_exit.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698