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

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

Issue 263903006: Reland "Make same-document history navigations commit with the proper type." (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/loader/FrameLoaderTypes.h ('k') | no next file » | 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 5082 matching lines...) Expand 10 before | Expand all | Expand 10 after
5093 registerMockedHttpURLLoad("push_state.html"); 5093 registerMockedHttpURLLoad("push_state.html");
5094 TestStartStopCallbackWebFrameClient client; 5094 TestStartStopCallbackWebFrameClient client;
5095 FrameTestHelpers::WebViewHelper webViewHelper; 5095 FrameTestHelpers::WebViewHelper webViewHelper;
5096 webViewHelper.initializeAndLoad(m_baseURL + "push_state.html", true, &client ); 5096 webViewHelper.initializeAndLoad(m_baseURL + "push_state.html", true, &client );
5097 5097
5098 EXPECT_EQ(client.startLoadingCount(), 2); 5098 EXPECT_EQ(client.startLoadingCount(), 2);
5099 EXPECT_EQ(client.stopLoadingCount(), 2); 5099 EXPECT_EQ(client.stopLoadingCount(), 2);
5100 EXPECT_EQ(client.differentDocumentStartCount(), 1); 5100 EXPECT_EQ(client.differentDocumentStartCount(), 1);
5101 } 5101 }
5102 5102
5103 class TestDidNavigateCommitTypeWebFrameClient : public FrameTestHelpers::TestWeb FrameClient {
5104 public:
5105 TestDidNavigateCommitTypeWebFrameClient()
5106 : m_lastCommitType(WebHistoryInertCommit)
5107 {
5108 }
5109
5110 virtual void didNavigateWithinPage(WebLocalFrame*, const WebHistoryItem&, We bHistoryCommitType type) OVERRIDE
5111 {
5112 m_lastCommitType = type;
5113 }
5114
5115 WebHistoryCommitType lastCommitType() const { return m_lastCommitType; }
5116
5117 private:
5118 WebHistoryCommitType m_lastCommitType;
5119 };
5120
5121 TEST_F(WebFrameTest, SameDocumentHistoryNavigationCommitType)
5122 {
5123 registerMockedHttpURLLoad("push_state.html");
5124 TestDidNavigateCommitTypeWebFrameClient client;
5125 FrameTestHelpers::WebViewHelper webViewHelper;
5126 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "push _state.html", true, &client);
5127 RefPtr<WebCore::HistoryItem> item = webViewImpl->page()->mainFrame()->loader ().currentItem();
5128 runPendingTasks();
5129
5130 webViewImpl->page()->mainFrame()->loader().loadHistoryItem(item.get(), WebCo re::HistorySameDocumentLoad);
5131 EXPECT_EQ(WebBackForwardCommit, client.lastCommitType());
5132 }
5133
5103 class TestHistoryWebFrameClient : public FrameTestHelpers::TestWebFrameClient { 5134 class TestHistoryWebFrameClient : public FrameTestHelpers::TestWebFrameClient {
5104 public: 5135 public:
5105 TestHistoryWebFrameClient() 5136 TestHistoryWebFrameClient()
5106 { 5137 {
5107 m_replacesCurrentHistoryItem = false; 5138 m_replacesCurrentHistoryItem = false;
5108 m_frame = 0; 5139 m_frame = 0;
5109 } 5140 }
5110 void didStartProvisionalLoad(WebLocalFrame* frame) 5141 void didStartProvisionalLoad(WebLocalFrame* frame)
5111 { 5142 {
5112 WebDataSource* ds = frame->provisionalDataSource(); 5143 WebDataSource* ds = frame->provisionalDataSource();
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
5402 registerMockedHttpURLLoad("link-manifest-change.html"); 5433 registerMockedHttpURLLoad("link-manifest-change.html");
5403 5434
5404 ManifestChangeWebFrameClient webFrameClient; 5435 ManifestChangeWebFrameClient webFrameClient;
5405 FrameTestHelpers::WebViewHelper webViewHelper; 5436 FrameTestHelpers::WebViewHelper webViewHelper;
5406 webViewHelper.initializeAndLoad(m_baseURL + "link-manifest-change.html", tru e, &webFrameClient); 5437 webViewHelper.initializeAndLoad(m_baseURL + "link-manifest-change.html", tru e, &webFrameClient);
5407 5438
5408 EXPECT_EQ(14, webFrameClient.manifestChangeCount()); 5439 EXPECT_EQ(14, webFrameClient.manifestChangeCount());
5409 } 5440 }
5410 5441
5411 } // namespace 5442 } // namespace
OLDNEW
« no previous file with comments | « Source/core/loader/FrameLoaderTypes.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698