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

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 fixes 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
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 4278 matching lines...) Expand 10 before | Expand all | Expand 10 after
4332 TEST_F(WebFrameTest, MoveCaretSelectionTowardsWindowPointWithNoSelection) 4333 TEST_F(WebFrameTest, MoveCaretSelectionTowardsWindowPointWithNoSelection)
4333 { 4334 {
4334 FrameTestHelpers::WebViewHelper webViewHelper; 4335 FrameTestHelpers::WebViewHelper webViewHelper;
4335 webViewHelper.initializeAndLoad("about:blank", true); 4336 webViewHelper.initializeAndLoad("about:blank", true);
4336 WebFrame* frame = webViewHelper.webView()->mainFrame(); 4337 WebFrame* frame = webViewHelper.webView()->mainFrame();
4337 4338
4338 // This test passes if this doesn't crash. 4339 // This test passes if this doesn't crash.
4339 frame->moveCaretSelection(WebPoint(0, 0)); 4340 frame->moveCaretSelection(WebPoint(0, 0));
4340 } 4341 }
4341 4342
4343 TEST_F(WebFrameTest, NavigateToSandboxedMarkup)
4344 {
4345 FrameTestHelpers::WebViewHelper webViewHelper;
4346 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad("about:blank", tr ue);
4347 WebLocalFrameImpl* frame = toWebLocalFrameImpl(webViewHelper.webView()->main Frame());
4348
4349 frame->document().setIsTransitionDocument();
4350
4351 std::string markup("<div id='foo'></div><script>document.getElementById('foo ').setAttribute('dir', 'rtl')</script>");
4352 frame->navigateToSandboxedMarkup(WebData(markup.data(), markup.length()));
4353 FrameTestHelpers::runPendingTasks();
4354
4355 WebDocument document = webViewImpl->mainFrame()->document();
4356 WebElement transitionElement = document.getElementById("foo");
4357 // Check that the markup got navigated to successfully.
4358 EXPECT_FALSE(transitionElement.isNull());
4359
4360 // Check that the inline script was not executed.
4361 EXPECT_FALSE(transitionElement.hasAttribute("dir"));
4362 }
4363
4342 class SpellCheckClient : public WebSpellCheckClient { 4364 class SpellCheckClient : public WebSpellCheckClient {
4343 public: 4365 public:
4344 explicit SpellCheckClient(uint32_t hash = 0) : m_numberOfTimesChecked(0), m_ hash(hash) { } 4366 explicit SpellCheckClient(uint32_t hash = 0) : m_numberOfTimesChecked(0), m_ hash(hash) { }
4345 virtual ~SpellCheckClient() { } 4367 virtual ~SpellCheckClient() { }
4346 virtual void requestCheckingOfText(const blink::WebString&, const blink::Web Vector<uint32_t>&, const blink::WebVector<unsigned>&, blink::WebTextCheckingComp letion* completion) OVERRIDE 4368 virtual void requestCheckingOfText(const blink::WebString&, const blink::Web Vector<uint32_t>&, const blink::WebVector<unsigned>&, blink::WebTextCheckingComp letion* completion) OVERRIDE
4347 { 4369 {
4348 ++m_numberOfTimesChecked; 4370 ++m_numberOfTimesChecked;
4349 Vector<WebTextCheckingResult> results; 4371 Vector<WebTextCheckingResult> results;
4350 const int misspellingStartOffset = 1; 4372 const int misspellingStartOffset = 1;
4351 const int misspellingLength = 8; 4373 const int misspellingLength = 8;
(...skipping 1570 matching lines...) Expand 10 before | Expand all | Expand 10 after
5922 5944
5923 client.reset(); 5945 client.reset();
5924 // Try to load the request with cross origin access. Should succeed. 5946 // Try to load the request with cross origin access. Should succeed.
5925 options.crossOriginRequestPolicy = blink::AllowCrossOriginRequests; 5947 options.crossOriginRequestPolicy = blink::AllowCrossOriginRequests;
5926 blink::DocumentThreadableLoader::loadResourceSynchronously( 5948 blink::DocumentThreadableLoader::loadResourceSynchronously(
5927 *frame->document(), blink::ResourceRequest(resourceUrl), client, options , resourceLoaderOptions); 5949 *frame->document(), blink::ResourceRequest(resourceUrl), client, options , resourceLoaderOptions);
5928 EXPECT_FALSE(client.failed()); 5950 EXPECT_FALSE(client.failed());
5929 } 5951 }
5930 5952
5931 } // namespace 5953 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698