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

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

Issue 7464009: Removal of Profile from content part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: slight tweaking for comments Created 9 years, 5 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 | « content/browser/browser_url_handler.cc ('k') | content/browser/browsing_instance.h » ('j') | 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 "chrome/test/testing_profile.h" 5 #include "chrome/test/testing_profile.h"
6 #include "content/browser/browser_url_handler.h" 6 #include "content/browser/browser_url_handler.h"
7 #include "googleurl/src/gurl.h" 7 #include "googleurl/src/gurl.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 class BrowserURLHandlerTest : public testing::Test { 10 class BrowserURLHandlerTest : public testing::Test {
11 }; 11 };
12 12
13 // Test URL rewriter that rewrites all "foo://" URLs to "bar://bar". 13 // Test URL rewriter that rewrites all "foo://" URLs to "bar://bar".
14 static bool FooRewriter(GURL* url, Profile* profile) { 14 static bool FooRewriter(GURL* url, content::BrowserContext* browser_context) {
15 if (url->scheme() == "foo") { 15 if (url->scheme() == "foo") {
16 *url = GURL("bar://bar"); 16 *url = GURL("bar://bar");
17 return true; 17 return true;
18 } 18 }
19 return false; 19 return false;
20 } 20 }
21 21
22 // Test URL rewriter that rewrites all "bar://" URLs to "foo://foo". 22 // Test URL rewriter that rewrites all "bar://" URLs to "foo://foo".
23 static bool BarRewriter(GURL* url, Profile* profile) { 23 static bool BarRewriter(GURL* url, content::BrowserContext* browser_context) {
24 if (url->scheme() == "bar") { 24 if (url->scheme() == "bar") {
25 *url = GURL("foo://foo"); 25 *url = GURL("foo://foo");
26 return true; 26 return true;
27 } 27 }
28 return false; 28 return false;
29 } 29 }
30 30
31 TEST_F(BrowserURLHandlerTest, BasicRewriteAndReverse) { 31 TEST_F(BrowserURLHandlerTest, BasicRewriteAndReverse) {
32 TestingProfile profile; 32 TestingProfile profile;
33 BrowserURLHandler handler; 33 BrowserURLHandler handler;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 handler.AddHandlerPair(BrowserURLHandler::null_handler(), FooRewriter); 65 handler.AddHandlerPair(BrowserURLHandler::null_handler(), FooRewriter);
66 bool reversed = handler.ReverseURLRewrite(&url, original_url, &profile); 66 bool reversed = handler.ReverseURLRewrite(&url, original_url, &profile);
67 ASSERT_FALSE(reversed); 67 ASSERT_FALSE(reversed);
68 ASSERT_EQ(original_url, url); 68 ASSERT_EQ(original_url, url);
69 69
70 handler.AddHandlerPair(BrowserURLHandler::null_handler(), BarRewriter); 70 handler.AddHandlerPair(BrowserURLHandler::null_handler(), BarRewriter);
71 reversed = handler.ReverseURLRewrite(&url, original_url, &profile); 71 reversed = handler.ReverseURLRewrite(&url, original_url, &profile);
72 ASSERT_TRUE(reversed); 72 ASSERT_TRUE(reversed);
73 ASSERT_EQ("foo://foo", url.spec()); 73 ASSERT_EQ("foo://foo", url.spec());
74 } 74 }
OLDNEW
« no previous file with comments | « content/browser/browser_url_handler.cc ('k') | content/browser/browsing_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698