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

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: Created 6 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
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 2609 matching lines...) Expand 10 before | Expand all | Expand 10 after
2620 webViewHelper.webView()->advanceFocus(true); 2620 webViewHelper.webView()->advanceFocus(true);
2621 webViewHelper.webViewImpl()->computeScaleAndScrollForFocusedNode(webViewHelp er.webViewImpl()->focusedElement(), scale, scroll, needAnimation); 2621 webViewHelper.webViewImpl()->computeScaleAndScrollForFocusedNode(webViewHelp er.webViewImpl()->focusedElement(), scale, scroll, needAnimation);
2622 // The position should have stayed the same since this box was already on sc reen with the right scale. 2622 // The position should have stayed the same since this box was already on sc reen with the right scale.
2623 EXPECT_FALSE(needAnimation); 2623 EXPECT_FALSE(needAnimation);
2624 } 2624 }
2625 2625
2626 class TestReloadDoesntRedirectWebFrameClient : public FrameTestHelpers::TestWebF rameClient { 2626 class TestReloadDoesntRedirectWebFrameClient : public FrameTestHelpers::TestWebF rameClient {
2627 public: 2627 public:
2628 virtual WebNavigationPolicy decidePolicyForNavigation( 2628 virtual WebNavigationPolicy decidePolicyForNavigation(
2629 WebLocalFrame*, WebDataSource::ExtraData*, const WebURLRequest&, WebNavi gationType, 2629 WebLocalFrame*, WebDataSource::ExtraData*, const WebURLRequest&, WebNavi gationType,
2630 WebNavigationPolicy defaultPolicy, bool isRedirect) OVERRIDE 2630 WebNavigationPolicy defaultPolicy, bool isRedirect, bool isTransitionNav igation) OVERRIDE
2631 { 2631 {
2632 EXPECT_FALSE(isRedirect); 2632 EXPECT_FALSE(isRedirect);
2633 return WebNavigationPolicyCurrentTab; 2633 return WebNavigationPolicyCurrentTab;
2634 } 2634 }
2635 }; 2635 };
2636 2636
2637 TEST_F(WebFrameTest, ReloadDoesntSetRedirect) 2637 TEST_F(WebFrameTest, ReloadDoesntSetRedirect)
2638 { 2638 {
2639 // Test for case in http://crbug.com/73104. Reloading a frame very quickly 2639 // Test for case in http://crbug.com/73104. Reloading a frame very quickly
2640 // would sometimes call decidePolicyForNavigation with isRedirect=true 2640 // would sometimes call decidePolicyForNavigation with isRedirect=true
(...skipping 2123 matching lines...) Expand 10 before | Expand all | Expand 10 after
4764 }; 4764 };
4765 4765
4766 class TestNewWindowWebFrameClient : public FrameTestHelpers::TestWebFrameClient { 4766 class TestNewWindowWebFrameClient : public FrameTestHelpers::TestWebFrameClient {
4767 public: 4767 public:
4768 TestNewWindowWebFrameClient() 4768 TestNewWindowWebFrameClient()
4769 : m_decidePolicyCallCount(0) 4769 : m_decidePolicyCallCount(0)
4770 { 4770 {
4771 } 4771 }
4772 4772
4773 virtual WebNavigationPolicy decidePolicyForNavigation(WebLocalFrame*, WebDat aSource::ExtraData*, const WebURLRequest&, 4773 virtual WebNavigationPolicy decidePolicyForNavigation(WebLocalFrame*, WebDat aSource::ExtraData*, const WebURLRequest&,
4774 WebNavigationType, WebNavigationPolicy policy, bool) OVERRIDE 4774 WebNavigationType, WebNavigationPolicy policy, bool, bool) OVERRIDE
4775 { 4775 {
4776 m_decidePolicyCallCount++; 4776 m_decidePolicyCallCount++;
4777 return policy; 4777 return policy;
4778 } 4778 }
4779 4779
4780 int decidePolicyCallCount() const { return m_decidePolicyCallCount; } 4780 int decidePolicyCallCount() const { return m_decidePolicyCallCount; }
4781 4781
4782 private: 4782 private:
4783 int m_decidePolicyCallCount; 4783 int m_decidePolicyCallCount;
4784 }; 4784 };
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
5117 EXPECT_EQ(WebBackForwardCommit, client.lastCommitType()); 5117 EXPECT_EQ(WebBackForwardCommit, client.lastCommitType());
5118 } 5118 }
5119 5119
5120 class TestHistoryWebFrameClient : public FrameTestHelpers::TestWebFrameClient { 5120 class TestHistoryWebFrameClient : public FrameTestHelpers::TestWebFrameClient {
5121 public: 5121 public:
5122 TestHistoryWebFrameClient() 5122 TestHistoryWebFrameClient()
5123 { 5123 {
5124 m_replacesCurrentHistoryItem = false; 5124 m_replacesCurrentHistoryItem = false;
5125 m_frame = 0; 5125 m_frame = 0;
5126 } 5126 }
5127 void didStartProvisionalLoad(WebLocalFrame* frame) 5127
5128 void didStartProvisionalLoad(WebLocalFrame* frame, bool isTransitionNavigati on)
5128 { 5129 {
5129 WebDataSource* ds = frame->provisionalDataSource(); 5130 WebDataSource* ds = frame->provisionalDataSource();
5130 m_replacesCurrentHistoryItem = ds->replacesCurrentHistoryItem(); 5131 m_replacesCurrentHistoryItem = ds->replacesCurrentHistoryItem();
5131 m_frame = frame; 5132 m_frame = frame;
5132 } 5133 }
5133 5134
5134 bool replacesCurrentHistoryItem() { return m_replacesCurrentHistoryItem; } 5135 bool replacesCurrentHistoryItem() { return m_replacesCurrentHistoryItem; }
5135 WebFrame* frame() { return m_frame; } 5136 WebFrame* frame() { return m_frame; }
5136 5137
5137 private: 5138 private:
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
5443 registerMockedHttpURLLoad("link-manifest-change.html"); 5444 registerMockedHttpURLLoad("link-manifest-change.html");
5444 5445
5445 ManifestChangeWebFrameClient webFrameClient; 5446 ManifestChangeWebFrameClient webFrameClient;
5446 FrameTestHelpers::WebViewHelper webViewHelper; 5447 FrameTestHelpers::WebViewHelper webViewHelper;
5447 webViewHelper.initializeAndLoad(m_baseURL + "link-manifest-change.html", tru e, &webFrameClient); 5448 webViewHelper.initializeAndLoad(m_baseURL + "link-manifest-change.html", tru e, &webFrameClient);
5448 5449
5449 EXPECT_EQ(14, webFrameClient.manifestChangeCount()); 5450 EXPECT_EQ(14, webFrameClient.manifestChangeCount());
5450 } 5451 }
5451 5452
5452 } // namespace 5453 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698