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

Unified Diff: chrome/browser/chrome_content_browser_client_unittest.cc

Issue 10780013: Add reverse URL handler for shortening uber URLs (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: comments 3 Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chrome_content_browser_client_unittest.cc
diff --git a/chrome/browser/chrome_content_browser_client_unittest.cc b/chrome/browser/chrome_content_browser_client_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..875fa27f42deae5010c6663d201b3f191342720c
--- /dev/null
+++ b/chrome/browser/chrome_content_browser_client_unittest.cc
@@ -0,0 +1,33 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/chrome_content_browser_client.h"
+#include "chrome/test/base/testing_profile.h"
+#include "content/browser/browser_url_handler_impl.h"
+#include "googleurl/src/gurl.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace chrome {
+
+TEST(ChromeContentBrowserClientTest, URLHandlers) {
+ ChromeContentBrowserClient client;
+ BrowserURLHandlerImpl* url_handler = BrowserURLHandlerImpl::GetInstance();
+ TestingProfile profile;
+
+ client.BrowserURLHandlerCreated(url_handler);
+
+ const GURL test_url_original("chrome://settings/");
+ const GURL test_url_rewritten("chrome://chrome/settings/");
+
+ GURL test_url = test_url_original;
+ bool needs_reverse = false;
+
+ url_handler->RewriteURLIfNecessary(&test_url, &profile, &needs_reverse);
+ EXPECT_EQ(test_url_rewritten, test_url);
+
+ url_handler->ReverseURLRewrite(&test_url, test_url_original, &profile);
+ EXPECT_EQ(test_url_original, test_url);
+}
+
+} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698