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

Side by Side Diff: content/browser/browser_url_handler_impl_unittest.cc

Issue 659153003: Add a unit test for viewsource reverse (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@viewsource
Patch Set: add some comments Created 6 years, 2 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 | « content/browser/browser_url_handler_impl.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 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/browser_url_handler_impl.h" 5 #include "content/browser/browser_url_handler_impl.h"
6 #include "content/public/test/test_browser_context.h" 6 #include "content/public/test/test_browser_context.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "url/gurl.h" 8 #include "url/gurl.h"
9 9
10 namespace content { 10 namespace content {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 &browser_context); 72 &browser_context);
73 ASSERT_FALSE(reversed); 73 ASSERT_FALSE(reversed);
74 ASSERT_EQ(original_url, url); 74 ASSERT_EQ(original_url, url);
75 75
76 handler.AddHandlerPair(BrowserURLHandlerImpl::null_handler(), BarRewriter); 76 handler.AddHandlerPair(BrowserURLHandlerImpl::null_handler(), BarRewriter);
77 reversed = handler.ReverseURLRewrite(&url, original_url, &browser_context); 77 reversed = handler.ReverseURLRewrite(&url, original_url, &browser_context);
78 ASSERT_TRUE(reversed); 78 ASSERT_TRUE(reversed);
79 ASSERT_EQ("foo://foo", url.spec()); 79 ASSERT_EQ("foo://foo", url.spec());
80 } 80 }
81 81
82 // Verify that the reverse handler for view-source does not duplicate query
83 // parameters.
84 TEST_F(BrowserURLHandlerImplTest, ViewSourceReverse) {
85 TestBrowserContext browser_context;
86 BrowserURLHandlerImpl handler;
87
88 GURL url("http://foo/?a=1");
89 GURL original_url("view-source:http://some_url");
90 bool reversed = handler.ReverseURLRewrite(&url,
91 original_url,
92 &browser_context);
93 ASSERT_TRUE(reversed);
94 ASSERT_EQ("view-source:http://foo/?a=1", url.spec());
95 }
96
82 } // namespace content 97 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_url_handler_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698