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

Unified Diff: chrome/browser/ui/webui/web_ui_util_unittest.cc

Issue 10837270: webui: Change slightly how the scale-factor gets parsed from a URL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . 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/ui/webui/web_ui_util_unittest.cc
diff --git a/chrome/browser/ui/webui/web_ui_util_unittest.cc b/chrome/browser/ui/webui/web_ui_util_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..810921f070e5d5a384b667a566269e34293cfed1
--- /dev/null
+++ b/chrome/browser/ui/webui/web_ui_util_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/ui/webui/web_ui_util.h"
+
+#include "googleurl/src/gurl.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+TEST(WebUIUtilTest, ParsePathAndScale) {
+ GURL url("chrome://some/random/username@email/and/more");
+ std::string path;
+ ui::ScaleFactor factor;
+
+ web_ui_util::ParsePathAndScale(url, &path, &factor);
+ EXPECT_EQ("random/username@email/and/more", path);
+ EXPECT_EQ(ui::SCALE_FACTOR_NONE, factor);
+
+ GURL url2("chrome://some/random/username@email/and/more@2x");
+ web_ui_util::ParsePathAndScale(url2, &path, &factor);
+ EXPECT_EQ("random/username@email/and/more", path);
+ EXPECT_EQ(ui::SCALE_FACTOR_200P, factor);
+
+ GURL url3("chrome://some/random/username/and/more@2x");
+ web_ui_util::ParsePathAndScale(url3, &path, &factor);
+ EXPECT_EQ("random/username/and/more", path);
+ EXPECT_EQ(ui::SCALE_FACTOR_200P, factor);
+
+ GURL url4("chrome://some/random/username/and/more");
+ web_ui_util::ParsePathAndScale(url4, &path, &factor);
+ EXPECT_EQ("random/username/and/more", path);
+ EXPECT_EQ(ui::SCALE_FACTOR_NONE, factor);
+}

Powered by Google App Engine
This is Rietveld 408576698