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

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 2623 matching lines...) Expand 10 before | Expand all | Expand 10 after
2634 2634
2635 // Move focus back to the first edit box. 2635 // Move focus back to the first edit box.
2636 webViewHelper.webView()->advanceFocus(true); 2636 webViewHelper.webView()->advanceFocus(true);
2637 webViewHelper.webViewImpl()->computeScaleAndScrollForFocusedNode(webViewHelp er.webViewImpl()->focusedElement(), scale, scroll, needAnimation); 2637 webViewHelper.webViewImpl()->computeScaleAndScrollForFocusedNode(webViewHelp er.webViewImpl()->focusedElement(), scale, scroll, needAnimation);
2638 // The position should have stayed the same since this box was already on sc reen with the right scale. 2638 // The position should have stayed the same since this box was already on sc reen with the right scale.
2639 EXPECT_FALSE(needAnimation); 2639 EXPECT_FALSE(needAnimation);
2640 } 2640 }
2641 2641
2642 class TestReloadDoesntRedirectWebFrameClient : public FrameTestHelpers::TestWebF rameClient { 2642 class TestReloadDoesntRedirectWebFrameClient : public FrameTestHelpers::TestWebF rameClient {
2643 public: 2643 public:
2644 virtual WebNavigationPolicy decidePolicyForNavigation( 2644 virtual WebNavigationPolicy decidePolicyForNavigation(const NavigationPolicy Info& info) OVERRIDE
2645 WebLocalFrame*, WebDataSource::ExtraData*, const WebURLRequest&, WebNavi gationType,
2646 WebNavigationPolicy defaultPolicy, bool isRedirect) OVERRIDE
2647 { 2645 {
2648 EXPECT_FALSE(isRedirect); 2646 EXPECT_FALSE(info.isRedirect);
2649 return WebNavigationPolicyCurrentTab; 2647 return WebNavigationPolicyCurrentTab;
2650 } 2648 }
2651 }; 2649 };
2652 2650
2653 TEST_F(WebFrameTest, ReloadDoesntSetRedirect) 2651 TEST_F(WebFrameTest, ReloadDoesntSetRedirect)
2654 { 2652 {
2655 // Test for case in http://crbug.com/73104. Reloading a frame very quickly 2653 // Test for case in http://crbug.com/73104. Reloading a frame very quickly
2656 // would sometimes call decidePolicyForNavigation with isRedirect=true 2654 // would sometimes call decidePolicyForNavigation with isRedirect=true
2657 registerMockedHttpURLLoad("form.html"); 2655 registerMockedHttpURLLoad("form.html");
2658 2656
(...skipping 2151 matching lines...) Expand 10 before | Expand all | Expand 10 after
4810 } 4808 }
4811 }; 4809 };
4812 4810
4813 class TestNewWindowWebFrameClient : public FrameTestHelpers::TestWebFrameClient { 4811 class TestNewWindowWebFrameClient : public FrameTestHelpers::TestWebFrameClient {
4814 public: 4812 public:
4815 TestNewWindowWebFrameClient() 4813 TestNewWindowWebFrameClient()
4816 : m_decidePolicyCallCount(0) 4814 : m_decidePolicyCallCount(0)
4817 { 4815 {
4818 } 4816 }
4819 4817
4820 virtual WebNavigationPolicy decidePolicyForNavigation(WebLocalFrame*, WebDat aSource::ExtraData*, const WebURLRequest&, 4818 virtual WebNavigationPolicy decidePolicyForNavigation(const NavigationPolicy Info& info) OVERRIDE
4821 WebNavigationType, WebNavigationPolicy policy, bool) OVERRIDE
4822 { 4819 {
4823 m_decidePolicyCallCount++; 4820 m_decidePolicyCallCount++;
4824 return policy; 4821 return info.defaultPolicy;
4825 } 4822 }
4826 4823
4827 int decidePolicyCallCount() const { return m_decidePolicyCallCount; } 4824 int decidePolicyCallCount() const { return m_decidePolicyCallCount; }
4828 4825
4829 private: 4826 private:
4830 int m_decidePolicyCallCount; 4827 int m_decidePolicyCallCount;
4831 }; 4828 };
4832 4829
4833 TEST_F(WebFrameTest, ModifiedClickNewWindow) 4830 TEST_F(WebFrameTest, ModifiedClickNewWindow)
4834 { 4831 {
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
5164 EXPECT_EQ(WebBackForwardCommit, client.lastCommitType()); 5161 EXPECT_EQ(WebBackForwardCommit, client.lastCommitType());
5165 } 5162 }
5166 5163
5167 class TestHistoryWebFrameClient : public FrameTestHelpers::TestWebFrameClient { 5164 class TestHistoryWebFrameClient : public FrameTestHelpers::TestWebFrameClient {
5168 public: 5165 public:
5169 TestHistoryWebFrameClient() 5166 TestHistoryWebFrameClient()
5170 { 5167 {
5171 m_replacesCurrentHistoryItem = false; 5168 m_replacesCurrentHistoryItem = false;
5172 m_frame = 0; 5169 m_frame = 0;
5173 } 5170 }
5174 void didStartProvisionalLoad(WebLocalFrame* frame) 5171
5172 void didStartProvisionalLoad(WebLocalFrame* frame, bool isTransitionNavigati on)
5175 { 5173 {
5176 WebDataSource* ds = frame->provisionalDataSource(); 5174 WebDataSource* ds = frame->provisionalDataSource();
5177 m_replacesCurrentHistoryItem = ds->replacesCurrentHistoryItem(); 5175 m_replacesCurrentHistoryItem = ds->replacesCurrentHistoryItem();
5178 m_frame = frame; 5176 m_frame = frame;
5179 } 5177 }
5180 5178
5181 bool replacesCurrentHistoryItem() { return m_replacesCurrentHistoryItem; } 5179 bool replacesCurrentHistoryItem() { return m_replacesCurrentHistoryItem; }
5182 WebFrame* frame() { return m_frame; } 5180 WebFrame* frame() { return m_frame; }
5183 5181
5184 private: 5182 private:
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
5577 { 5575 {
5578 registerMockedHttpURLLoad("brand_color_test.html"); 5576 registerMockedHttpURLLoad("brand_color_test.html");
5579 FrameTestHelpers::WebViewHelper webViewHelper; 5577 FrameTestHelpers::WebViewHelper webViewHelper;
5580 BrandColorTestWebFrameClient client; 5578 BrandColorTestWebFrameClient client;
5581 webViewHelper.initializeAndLoad(m_baseURL + "brand_color_test.html", false, &client); 5579 webViewHelper.initializeAndLoad(m_baseURL + "brand_color_test.html", false, &client);
5582 EXPECT_TRUE(client.didNotify()); 5580 EXPECT_TRUE(client.didNotify());
5583 EXPECT_EQ(0xff0000ff, client.brandColor()); 5581 EXPECT_EQ(0xff0000ff, client.brandColor());
5584 } 5582 }
5585 5583
5586 } // namespace 5584 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698