OLD | NEW |
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/base/testing_browser_process_test.h" |
5 #include "chrome/test/base/testing_profile.h" | 6 #include "chrome/test/base/testing_profile.h" |
6 #include "chrome/test/testing_browser_process_test.h" | |
7 #include "content/browser/browser_url_handler.h" | 7 #include "content/browser/browser_url_handler.h" |
8 #include "googleurl/src/gurl.h" | 8 #include "googleurl/src/gurl.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 class BrowserURLHandlerTest : public TestingBrowserProcessTest { | 11 class BrowserURLHandlerTest : public TestingBrowserProcessTest { |
12 }; | 12 }; |
13 | 13 |
14 // Test URL rewriter that rewrites all "foo://" URLs to "bar://bar". | 14 // Test URL rewriter that rewrites all "foo://" URLs to "bar://bar". |
15 static bool FooRewriter(GURL* url, content::BrowserContext* browser_context) { | 15 static bool FooRewriter(GURL* url, content::BrowserContext* browser_context) { |
16 if (url->scheme() == "foo") { | 16 if (url->scheme() == "foo") { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 handler.AddHandlerPair(BrowserURLHandler::null_handler(), FooRewriter); | 66 handler.AddHandlerPair(BrowserURLHandler::null_handler(), FooRewriter); |
67 bool reversed = handler.ReverseURLRewrite(&url, original_url, &profile); | 67 bool reversed = handler.ReverseURLRewrite(&url, original_url, &profile); |
68 ASSERT_FALSE(reversed); | 68 ASSERT_FALSE(reversed); |
69 ASSERT_EQ(original_url, url); | 69 ASSERT_EQ(original_url, url); |
70 | 70 |
71 handler.AddHandlerPair(BrowserURLHandler::null_handler(), BarRewriter); | 71 handler.AddHandlerPair(BrowserURLHandler::null_handler(), BarRewriter); |
72 reversed = handler.ReverseURLRewrite(&url, original_url, &profile); | 72 reversed = handler.ReverseURLRewrite(&url, original_url, &profile); |
73 ASSERT_TRUE(reversed); | 73 ASSERT_TRUE(reversed); |
74 ASSERT_EQ("foo://foo", url.spec()); | 74 ASSERT_EQ("foo://foo", url.spec()); |
75 } | 75 } |
OLD | NEW |