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

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

Issue 319573008: Navigation transitions: Initiate navigation transition and send serialized markup to Chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@transitions_editing
Patch Set: Rebase Created 6 years, 5 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/FrameLoaderClientImpl.cpp ('k') | public/web/WebFrameClient.h » ('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 2632 matching lines...) Expand 10 before | Expand all | Expand 10 after
2643 2643
2644 // Move focus back to the first edit box. 2644 // Move focus back to the first edit box.
2645 webViewHelper.webView()->advanceFocus(true); 2645 webViewHelper.webView()->advanceFocus(true);
2646 webViewHelper.webViewImpl()->computeScaleAndScrollForFocusedNode(webViewHelp er.webViewImpl()->focusedElement(), scale, scroll, needAnimation); 2646 webViewHelper.webViewImpl()->computeScaleAndScrollForFocusedNode(webViewHelp er.webViewImpl()->focusedElement(), scale, scroll, needAnimation);
2647 // The position should have stayed the same since this box was already on sc reen with the right scale. 2647 // The position should have stayed the same since this box was already on sc reen with the right scale.
2648 EXPECT_FALSE(needAnimation); 2648 EXPECT_FALSE(needAnimation);
2649 } 2649 }
2650 2650
2651 class TestReloadDoesntRedirectWebFrameClient : public FrameTestHelpers::TestWebF rameClient { 2651 class TestReloadDoesntRedirectWebFrameClient : public FrameTestHelpers::TestWebF rameClient {
2652 public: 2652 public:
2653 virtual WebNavigationPolicy decidePolicyForNavigation( 2653 virtual WebNavigationPolicy decidePolicyForNavigation(const NavigationPolicy Info& info) OVERRIDE
2654 WebLocalFrame*, WebDataSource::ExtraData*, const WebURLRequest&, WebNavi gationType,
2655 WebNavigationPolicy defaultPolicy, bool isRedirect) OVERRIDE
2656 { 2654 {
2657 EXPECT_FALSE(isRedirect); 2655 EXPECT_FALSE(info.isRedirect);
2658 return WebNavigationPolicyCurrentTab; 2656 return WebNavigationPolicyCurrentTab;
2659 } 2657 }
2660 }; 2658 };
2661 2659
2662 TEST_F(WebFrameTest, ReloadDoesntSetRedirect) 2660 TEST_F(WebFrameTest, ReloadDoesntSetRedirect)
2663 { 2661 {
2664 // Test for case in http://crbug.com/73104. Reloading a frame very quickly 2662 // Test for case in http://crbug.com/73104. Reloading a frame very quickly
2665 // would sometimes call decidePolicyForNavigation with isRedirect=true 2663 // would sometimes call decidePolicyForNavigation with isRedirect=true
2666 registerMockedHttpURLLoad("form.html"); 2664 registerMockedHttpURLLoad("form.html");
2667 2665
(...skipping 2269 matching lines...) Expand 10 before | Expand all | Expand 10 after
4937 } 4935 }
4938 }; 4936 };
4939 4937
4940 class TestNewWindowWebFrameClient : public FrameTestHelpers::TestWebFrameClient { 4938 class TestNewWindowWebFrameClient : public FrameTestHelpers::TestWebFrameClient {
4941 public: 4939 public:
4942 TestNewWindowWebFrameClient() 4940 TestNewWindowWebFrameClient()
4943 : m_decidePolicyCallCount(0) 4941 : m_decidePolicyCallCount(0)
4944 { 4942 {
4945 } 4943 }
4946 4944
4947 virtual WebNavigationPolicy decidePolicyForNavigation(WebLocalFrame*, WebDat aSource::ExtraData*, const WebURLRequest&, 4945 virtual WebNavigationPolicy decidePolicyForNavigation(const NavigationPolicy Info& info) OVERRIDE
4948 WebNavigationType, WebNavigationPolicy policy, bool) OVERRIDE
4949 { 4946 {
4950 m_decidePolicyCallCount++; 4947 m_decidePolicyCallCount++;
4951 return policy; 4948 return info.defaultPolicy;
4952 } 4949 }
4953 4950
4954 int decidePolicyCallCount() const { return m_decidePolicyCallCount; } 4951 int decidePolicyCallCount() const { return m_decidePolicyCallCount; }
4955 4952
4956 private: 4953 private:
4957 int m_decidePolicyCallCount; 4954 int m_decidePolicyCallCount;
4958 }; 4955 };
4959 4956
4960 TEST_F(WebFrameTest, ModifiedClickNewWindow) 4957 TEST_F(WebFrameTest, ModifiedClickNewWindow)
4961 { 4958 {
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
5291 EXPECT_EQ(WebBackForwardCommit, client.lastCommitType()); 5288 EXPECT_EQ(WebBackForwardCommit, client.lastCommitType());
5292 } 5289 }
5293 5290
5294 class TestHistoryWebFrameClient : public FrameTestHelpers::TestWebFrameClient { 5291 class TestHistoryWebFrameClient : public FrameTestHelpers::TestWebFrameClient {
5295 public: 5292 public:
5296 TestHistoryWebFrameClient() 5293 TestHistoryWebFrameClient()
5297 { 5294 {
5298 m_replacesCurrentHistoryItem = false; 5295 m_replacesCurrentHistoryItem = false;
5299 m_frame = 0; 5296 m_frame = 0;
5300 } 5297 }
5301 void didStartProvisionalLoad(WebLocalFrame* frame) 5298
5299 void didStartProvisionalLoad(WebLocalFrame* frame, bool isTransitionNavigati on)
5302 { 5300 {
5303 WebDataSource* ds = frame->provisionalDataSource(); 5301 WebDataSource* ds = frame->provisionalDataSource();
5304 m_replacesCurrentHistoryItem = ds->replacesCurrentHistoryItem(); 5302 m_replacesCurrentHistoryItem = ds->replacesCurrentHistoryItem();
5305 m_frame = frame; 5303 m_frame = frame;
5306 } 5304 }
5307 5305
5308 bool replacesCurrentHistoryItem() { return m_replacesCurrentHistoryItem; } 5306 bool replacesCurrentHistoryItem() { return m_replacesCurrentHistoryItem; }
5309 WebFrame* frame() { return m_frame; } 5307 WebFrame* frame() { return m_frame; }
5310 5308
5311 private: 5309 private:
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
5908 5906
5909 client.reset(); 5907 client.reset();
5910 // Try to load the request with cross origin access. Should succeed. 5908 // Try to load the request with cross origin access. Should succeed.
5911 options.crossOriginRequestPolicy = WebCore::AllowCrossOriginRequests; 5909 options.crossOriginRequestPolicy = WebCore::AllowCrossOriginRequests;
5912 WebCore::DocumentThreadableLoader::loadResourceSynchronously( 5910 WebCore::DocumentThreadableLoader::loadResourceSynchronously(
5913 *frame->document(), WebCore::ResourceRequest(resourceUrl), client, optio ns, resourceLoaderOptions); 5911 *frame->document(), WebCore::ResourceRequest(resourceUrl), client, optio ns, resourceLoaderOptions);
5914 EXPECT_FALSE(client.failed()); 5912 EXPECT_FALSE(client.failed());
5915 } 5913 }
5916 5914
5917 } // namespace 5915 } // namespace
OLDNEW
« no previous file with comments | « Source/web/FrameLoaderClientImpl.cpp ('k') | public/web/WebFrameClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698