summaryrefslogtreecommitdiffstats
path: root/components/data_reduction_proxy
diff options
context:
space:
mode:
authoravi <avi@chromium.org>2015-04-27 18:30:02 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-28 01:29:57 +0000
commit5671403d44971669e4d81aecf3f002188ce0e95f (patch)
tree176e6bd1fa7b002d7d3a7d88c5c1e16b47550ba5 /components/data_reduction_proxy
parent3029d2b48c15ea0f15e918d705ca6863d3e2172b (diff)
downloadchromium_src-5671403d44971669e4d81aecf3f002188ce0e95f.zip
chromium_src-5671403d44971669e4d81aecf3f002188ce0e95f.tar.gz
chromium_src-5671403d44971669e4d81aecf3f002188ce0e95f.tar.bz2
Classify navigations without page id in parallel to the existing classifier.
For now, this only happens in debug builds. BUG=369661 TEST=NavigationControllerBrowserTest.NavigationTypeClassification_* TEST=Every other test on the planet. Committed: https://crrev.com/d8d93348bbd8c646c337bdaa40fc0c64204fc5ff Cr-Commit-Position: refs/heads/master@{#327122} Reverted: https://crrev.com/5348e920f4119aff9a4eb76c0965725dc85a66cc Cr-Revert-Position: refs/heads/master@{#327152} Review URL: https://codereview.chromium.org/1002803002 Cr-Commit-Position: refs/heads/master@{#327214}
Diffstat (limited to 'components/data_reduction_proxy')
-rw-r--r--components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_blocking_page_unittest.cc95
1 files changed, 63 insertions, 32 deletions
diff --git a/components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_blocking_page_unittest.cc b/components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_blocking_page_unittest.cc
index 0effde6..64d5076 100644
--- a/components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_blocking_page_unittest.cc
+++ b/components/data_reduction_proxy/content/browser/data_reduction_proxy_debug_blocking_page_unittest.cc
@@ -104,29 +104,56 @@ class DataReductionProxyDebugBlockingPageTest
user_response_ = CANCEL;
}
- void Navigate(const char* url, int page_id) {
- content::WebContentsTester::For(web_contents())->TestDidNavigate(
- web_contents()->GetMainFrame(), page_id, GURL(url),
- ui::PAGE_TRANSITION_TYPED);
+ void Navigate(const char* url,
+ int page_id,
+ int nav_entry_id,
+ bool did_create_new_entry) {
+ NavigateInternal(url, page_id, nav_entry_id, did_create_new_entry, false);
+ }
+
+ void NavigateCrossSite(const char* url,
+ int page_id,
+ int nav_entry_id,
+ bool did_create_new_entry) {
+ NavigateInternal(url, page_id, nav_entry_id, did_create_new_entry, true);
+ }
+
+ void NavigateInternal(const char* url,
+ int page_id,
+ int nav_entry_id,
+ bool did_create_new_entry,
+ bool is_cross_site) {
+ // The pending RVH should commit for cross-site navigations.
+ content::RenderFrameHost* render_frame_host =
+ is_cross_site
+ ? content::WebContentsTester::For(web_contents())
+ ->GetPendingMainFrame()
+ : web_contents()->GetMainFrame();
+
+ content::WebContentsTester::For(web_contents())
+ ->TestDidNavigate(render_frame_host, page_id, nav_entry_id,
+ did_create_new_entry, GURL(url),
+ ui::PAGE_TRANSITION_TYPED);
}
void GoBack(bool is_cross_site) {
- content::NavigationEntry* entry =
- web_contents()->GetController().GetEntryAtOffset(-1);
- ASSERT_TRUE(entry);
- web_contents()->GetController().GoBack();
-
- // The pending RVH should commit for cross-site navigations.
- content::RenderFrameHost* render_frame_host = is_cross_site ?
- content::WebContentsTester::For(
- web_contents())->GetPendingMainFrame() :
- web_contents()->GetMainFrame();
- content::WebContentsTester::For(web_contents())->TestDidNavigate(
- render_frame_host,
- entry->GetPageID(),
- GURL(entry->GetURL()),
- ui::PAGE_TRANSITION_TYPED);
- }
+ content::NavigationEntry* entry =
+ web_contents()->GetController().GetEntryAtOffset(-1);
+ ASSERT_TRUE(entry);
+ web_contents()->GetController().GoBack();
+
+ // The pending RVH should commit for cross-site navigations.
+ content::RenderFrameHost* render_frame_host =
+ is_cross_site
+ ? content::WebContentsTester::For(web_contents())
+ ->GetPendingMainFrame()
+ : web_contents()->GetMainFrame();
+
+ content::WebContentsTester::For(web_contents())
+ ->TestDidNavigate(render_frame_host, entry->GetPageID(),
+ entry->GetUniqueID(), false, GURL(entry->GetURL()),
+ ui::PAGE_TRANSITION_TYPED);
+ }
void ShowInterstitial(bool is_subresource, const char* url) {
DataReductionProxyDebugUIManager::BypassResource resource;
@@ -229,6 +256,7 @@ TEST_F(DataReductionProxyDebugBlockingPageTest, BypassPageProceed) {
// Start a load.
controller().LoadURL(GURL(kBypassURL), content::Referrer(),
ui::PAGE_TRANSITION_TYPED, std::string());
+ int pending_id = controller().GetPendingEntry()->GetUniqueID();
// Simulate the load causing an interstitial to be shown.
ShowInterstitial(false, kBypassURL);
@@ -244,7 +272,7 @@ TEST_F(DataReductionProxyDebugBlockingPageTest, BypassPageProceed) {
// The interstitial is shown until the navigation commits.
ASSERT_TRUE(GetDataReductionProxyDebugBlockingPage());
// Commit the navigation.
- Navigate(kBypassURL, 1);
+ Navigate(kBypassURL, 1, pending_id, true);
// The interstitial should be gone now.
EXPECT_EQ(OK, user_response());
ASSERT_FALSE(GetDataReductionProxyDebugBlockingPage());
@@ -254,10 +282,10 @@ TEST_F(DataReductionProxyDebugBlockingPageTest, BypassPageProceed) {
// and not proceeding.
TEST_F(DataReductionProxyDebugBlockingPageTest, BypassSubresourceDontProceed) {
// Navigate somewhere.
- Navigate(kGoogleURL, 1);
+ Navigate(kGoogleURL, 1, 0, true);
// Navigate somewhere else.
- Navigate(kOtherURL, 2);
+ Navigate(kOtherURL, 2, 0, true);
// Simulate that page loading a bypass-resource triggering an interstitial.
ShowInterstitial(true, kBypassURL);
@@ -283,7 +311,7 @@ TEST_F(DataReductionProxyDebugBlockingPageTest, BypassSubresourceDontProceed) {
// and proceeding.
TEST_F(DataReductionProxyDebugBlockingPageTest, BypassSubresourceProceed) {
// Navigate somewhere.
- Navigate(kGoogleURL, 1);
+ Navigate(kGoogleURL, 1, 0, true);
// Simulate that page loading a bypass-resource triggering an interstitial.
ShowInterstitial(true, kBypassURL);
@@ -310,15 +338,15 @@ TEST_F(DataReductionProxyDebugBlockingPageTest, BypassSubresourceProceed) {
TEST_F(DataReductionProxyDebugBlockingPageTest,
BypassMultipleSubresourcesDontProceed) {
// Navigate somewhere.
- Navigate(kGoogleURL, 1);
+ Navigate(kGoogleURL, 1, 0, true);
// Navigate somewhere else.
- Navigate(kOtherURL, 2);
+ Navigate(kOtherURL, 2, 0, true);
// Simulate that page loading a bypass-resource triggering an interstitial.
ShowInterstitial(true, kBypassURL);
- // More bypassedd resources loading causing more interstitials. The new
+ // More bypassed resources loading causing more interstitials. The new
// interstitials should be queued.
ShowInterstitial(true, kBypassURL2);
ShowInterstitial(true, kBypassURL3);
@@ -332,7 +360,7 @@ TEST_F(DataReductionProxyDebugBlockingPageTest,
EXPECT_EQ(CANCEL, user_response());
EXPECT_FALSE(GetDataReductionProxyDebugBlockingPage());
- // The user did not proceed, the controler should be back to the first page,
+ // The user did not proceed, the controller should be back to the first page,
// the 2nd one should have been removed from the navigation controller.
ASSERT_EQ(1, controller().GetEntryCount());
EXPECT_EQ(kGoogleURL, controller().GetActiveEntry()->GetURL().spec());
@@ -344,7 +372,7 @@ TEST_F(DataReductionProxyDebugBlockingPageTest,
TEST_F(DataReductionProxyDebugBlockingPageTest,
BypassMultipleSubresourcesProceed) {
// Navigate somewhere.
- Navigate(kGoogleURL, 1);
+ Navigate(kGoogleURL, 1, 0, true);
// Simulate that page loading a bypass-resource triggering an interstitial.
ShowInterstitial(true, kBypassURL);
@@ -371,11 +399,12 @@ TEST_F(DataReductionProxyDebugBlockingPageTest,
// controller entries are OK.
TEST_F(DataReductionProxyDebugBlockingPageTest, NavigatingBackAndForth) {
// Navigate somewhere.
- Navigate(kGoogleURL, 1);
+ Navigate(kGoogleURL, 1, 0, true);
// Now navigate to a bypassed page triggerring an interstitial.
controller().LoadURL(GURL(kBypassURL), content::Referrer(),
ui::PAGE_TRANSITION_TYPED, std::string());
+ int pending_id = controller().GetPendingEntry()->GetUniqueID();
ShowInterstitial(false, kBypassURL);
DataReductionProxyDebugBlockingPage* interstitial =
GetDataReductionProxyDebugBlockingPage();
@@ -383,7 +412,7 @@ TEST_F(DataReductionProxyDebugBlockingPageTest, NavigatingBackAndForth) {
// Proceed through the 1st interstitial.
ProceedThroughInterstitial(interstitial);
- Navigate(kBypassURL, 2); // Commit the navigation.
+ Navigate(kBypassURL, 2, pending_id, true); // Commit navigation.
GoBack(true);
// We are back on the first page.
@@ -394,13 +423,15 @@ TEST_F(DataReductionProxyDebugBlockingPageTest, NavigatingBackAndForth) {
// Navigate forward to the bypassed URL.
web_contents()->GetController().GoForward();
+ pending_id = controller().GetPendingEntry()->GetUniqueID();
ShowInterstitial(false, kBypassURL);
interstitial = GetDataReductionProxyDebugBlockingPage();
ASSERT_TRUE(interstitial);
// Let's proceed and make sure everything is OK.
ProceedThroughInterstitial(interstitial);
- Navigate(kBypassURL, 2); // Commit the navigation.
+ // Commit the navigation.
+ NavigateCrossSite(kBypassURL, 2, pending_id, false);
interstitial = GetDataReductionProxyDebugBlockingPage();
ASSERT_FALSE(interstitial);
ASSERT_EQ(2, controller().GetEntryCount());