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

Side by Side Diff: Source/web/tests/ViewportTest.cpp

Issue 133673002: Reduce viewport arguments parsing noise in the DevTools console (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 11 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 2964 matching lines...) Expand 10 before | Expand all | Expand 10 after
2975 2975
2976 registerMockedHttpURLLoad("viewport/viewport-warnings-2.html"); 2976 registerMockedHttpURLLoad("viewport/viewport-warnings-2.html");
2977 2977
2978 FrameTestHelpers::WebViewHelper webViewHelper; 2978 FrameTestHelpers::WebViewHelper webViewHelper;
2979 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-warnings-2.ht ml", true, 0, &webViewClient, setViewportSettings); 2979 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-warnings-2.ht ml", true, 0, &webViewClient, setViewportSettings);
2980 2980
2981 Page* page = webViewHelper.webViewImpl()->page(); 2981 Page* page = webViewHelper.webViewImpl()->page();
2982 PageScaleConstraints constraints = runViewportTest(page, 320, 352); 2982 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
2983 2983
2984 EXPECT_EQ(1U, webViewClient.messages.size()); 2984 EXPECT_EQ(1U, webViewClient.messages.size());
2985 EXPECT_EQ(WebConsoleMessage::LevelError, webViewClient.messages[0].level); 2985 EXPECT_EQ(WebConsoleMessage::LevelWarning, webViewClient.messages[0].level);
2986 EXPECT_STREQ("The key \"wwidth\" is not recognized and ignored.", webViewCli ent.messages[0].text.utf8().c_str()); 2986 EXPECT_STREQ("The key \"wwidth\" is not recognized and ignored.", webViewCli ent.messages[0].text.utf8().c_str());
2987 2987
2988 EXPECT_EQ(980, constraints.layoutSize.width()); 2988 EXPECT_EQ(980, constraints.layoutSize.width());
2989 EXPECT_EQ(1078, constraints.layoutSize.height()); 2989 EXPECT_EQ(1078, constraints.layoutSize.height());
2990 EXPECT_NEAR(0.33f, constraints.initialScale, 0.01f); 2990 EXPECT_NEAR(0.33f, constraints.initialScale, 0.01f);
2991 EXPECT_NEAR(0.33f, constraints.minimumScale, 0.01f); 2991 EXPECT_NEAR(0.33f, constraints.minimumScale, 0.01f);
2992 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f); 2992 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
2993 EXPECT_TRUE(page->viewportDescription().userZoom); 2993 EXPECT_TRUE(page->viewportDescription().userZoom);
2994 } 2994 }
2995 2995
2996 TEST_F(ViewportTest, viewportWarnings3) 2996 TEST_F(ViewportTest, viewportWarnings3)
2997 { 2997 {
2998 ConsoleMessageWebViewClient webViewClient; 2998 ConsoleMessageWebViewClient webViewClient;
2999 2999
3000 registerMockedHttpURLLoad("viewport/viewport-warnings-3.html"); 3000 registerMockedHttpURLLoad("viewport/viewport-warnings-3.html");
3001 3001
3002 FrameTestHelpers::WebViewHelper webViewHelper; 3002 FrameTestHelpers::WebViewHelper webViewHelper;
3003 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-warnings-3.ht ml", true, 0, &webViewClient, setViewportSettings); 3003 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-warnings-3.ht ml", true, 0, &webViewClient, setViewportSettings);
3004 3004
3005 Page* page = webViewHelper.webViewImpl()->page(); 3005 Page* page = webViewHelper.webViewImpl()->page();
3006 PageScaleConstraints constraints = runViewportTest(page, 320, 352); 3006 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
3007 3007
3008 EXPECT_EQ(1U, webViewClient.messages.size()); 3008 EXPECT_EQ(1U, webViewClient.messages.size());
3009 EXPECT_EQ(WebConsoleMessage::LevelError, webViewClient.messages[0].level); 3009 EXPECT_EQ(WebConsoleMessage::LevelWarning, webViewClient.messages[0].level);
3010 EXPECT_STREQ("The value \"unrecognized-width\" for key \"width\" is invalid, and has been ignored.", 3010 EXPECT_STREQ("The value \"unrecognized-width\" for key \"width\" is invalid, and has been ignored.",
3011 webViewClient.messages[0].text.utf8().c_str()); 3011 webViewClient.messages[0].text.utf8().c_str());
3012 3012
3013 EXPECT_NEAR(64.0f, constraints.layoutSize.width(), 0.01); 3013 EXPECT_NEAR(64.0f, constraints.layoutSize.width(), 0.01);
3014 EXPECT_NEAR(70.4f, constraints.layoutSize.height(), 0.01); 3014 EXPECT_NEAR(70.4f, constraints.layoutSize.height(), 0.01);
3015 EXPECT_NEAR(5.0f, constraints.initialScale, 0.01f); 3015 EXPECT_NEAR(5.0f, constraints.initialScale, 0.01f);
3016 EXPECT_NEAR(5.0f, constraints.minimumScale, 0.01f); 3016 EXPECT_NEAR(5.0f, constraints.minimumScale, 0.01f);
3017 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f); 3017 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
3018 EXPECT_TRUE(page->viewportDescription().userZoom); 3018 EXPECT_TRUE(page->viewportDescription().userZoom);
3019 } 3019 }
(...skipping 30 matching lines...) Expand all
3050 registerMockedHttpURLLoad("viewport/viewport-warnings-5.html"); 3050 registerMockedHttpURLLoad("viewport/viewport-warnings-5.html");
3051 3051
3052 FrameTestHelpers::WebViewHelper webViewHelper; 3052 FrameTestHelpers::WebViewHelper webViewHelper;
3053 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-warnings-5.ht ml", true, 0, &webViewClient, setViewportSettings); 3053 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-warnings-5.ht ml", true, 0, &webViewClient, setViewportSettings);
3054 3054
3055 Page* page = webViewHelper.webViewImpl()->page(); 3055 Page* page = webViewHelper.webViewImpl()->page();
3056 PageScaleConstraints constraints = runViewportTest(page, 320, 352); 3056 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
3057 3057
3058 EXPECT_EQ(5U, webViewClient.messages.size()); 3058 EXPECT_EQ(5U, webViewClient.messages.size());
3059 3059
3060 EXPECT_EQ(WebConsoleMessage::LevelError, webViewClient.messages[0].level); 3060 EXPECT_EQ(WebConsoleMessage::LevelWarning, webViewClient.messages[0].level);
3061 EXPECT_STREQ("The value \"device-width;\" for key \"width\" is invalid, and has been ignored.", 3061 EXPECT_STREQ("The value \"device-width;\" for key \"width\" is invalid, and has been ignored.",
3062 webViewClient.messages[0].text.utf8().c_str()); 3062 webViewClient.messages[0].text.utf8().c_str());
3063 3063
3064 EXPECT_EQ(WebConsoleMessage::LevelWarning, webViewClient.messages[1].level); 3064 EXPECT_EQ(WebConsoleMessage::LevelWarning, webViewClient.messages[1].level);
3065 EXPECT_STREQ("The value \"1.0;\" for key \"initial-scale\" was truncated to its numeric prefix.", 3065 EXPECT_STREQ("The value \"1.0;\" for key \"initial-scale\" was truncated to its numeric prefix.",
3066 webViewClient.messages[1].text.utf8().c_str()); 3066 webViewClient.messages[1].text.utf8().c_str());
3067 3067
3068 EXPECT_EQ(WebConsoleMessage::LevelWarning, webViewClient.messages[2].level); 3068 EXPECT_EQ(WebConsoleMessage::LevelWarning, webViewClient.messages[2].level);
3069 EXPECT_STREQ("The value \"1.0;\" for key \"maximum-scale\" was truncated to its numeric prefix.", 3069 EXPECT_STREQ("The value \"1.0;\" for key \"maximum-scale\" was truncated to its numeric prefix.",
3070 webViewClient.messages[2].text.utf8().c_str()); 3070 webViewClient.messages[2].text.utf8().c_str());
(...skipping 20 matching lines...) Expand all
3091 3091
3092 registerMockedHttpURLLoad("viewport/viewport-warnings-6.html"); 3092 registerMockedHttpURLLoad("viewport/viewport-warnings-6.html");
3093 3093
3094 FrameTestHelpers::WebViewHelper webViewHelper; 3094 FrameTestHelpers::WebViewHelper webViewHelper;
3095 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-warnings-6.ht ml", true, 0, &webViewClient, setViewportSettings); 3095 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-warnings-6.ht ml", true, 0, &webViewClient, setViewportSettings);
3096 3096
3097 Page* page = webViewHelper.webViewImpl()->page(); 3097 Page* page = webViewHelper.webViewImpl()->page();
3098 PageScaleConstraints constraints = runViewportTest(page, 320, 352); 3098 PageScaleConstraints constraints = runViewportTest(page, 320, 352);
3099 3099
3100 EXPECT_EQ(1U, webViewClient.messages.size()); 3100 EXPECT_EQ(1U, webViewClient.messages.size());
3101 EXPECT_EQ(WebConsoleMessage::LevelError, webViewClient.messages[0].level); 3101 EXPECT_EQ(WebConsoleMessage::LevelWarning, webViewClient.messages[0].level);
3102 EXPECT_STREQ("The value \"\" for key \"width\" is invalid, and has been igno red.", 3102 EXPECT_STREQ("The value \"\" for key \"width\" is invalid, and has been igno red.",
3103 webViewClient.messages[0].text.utf8().c_str()); 3103 webViewClient.messages[0].text.utf8().c_str());
3104 3104
3105 EXPECT_NEAR(64.0f, constraints.layoutSize.width(), 0.01); 3105 EXPECT_NEAR(64.0f, constraints.layoutSize.width(), 0.01);
3106 EXPECT_NEAR(70.4f, constraints.layoutSize.height(), 0.01); 3106 EXPECT_NEAR(70.4f, constraints.layoutSize.height(), 0.01);
3107 EXPECT_NEAR(5.0f, constraints.initialScale, 0.01f); 3107 EXPECT_NEAR(5.0f, constraints.initialScale, 0.01f);
3108 EXPECT_NEAR(5.0f, constraints.minimumScale, 0.01f); 3108 EXPECT_NEAR(5.0f, constraints.minimumScale, 0.01f);
3109 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f); 3109 EXPECT_NEAR(5.0f, constraints.maximumScale, 0.01f);
3110 EXPECT_TRUE(page->viewportDescription().userZoom); 3110 EXPECT_TRUE(page->viewportDescription().userZoom);
3111 } 3111 }
3112 3112
3113 TEST_F(ViewportTest, viewportWarnings7)
3114 {
3115 ConsoleMessageWebViewClient webViewClient;
3116
3117 registerMockedHttpURLLoad("viewport/viewport-warnings-7.html");
3118
3119 FrameTestHelpers::WebViewHelper webViewHelper;
3120 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-warnings-7.ht ml", true, 0, &webViewClient, setViewportSettings);
3121
3122 Page* page = webViewHelper.webViewImpl()->page();
3123 runViewportTest(page, 320, 352);
3124
3125 EXPECT_EQ(0U, webViewClient.messages.size());
3126 }
3127
3113 } // namespace 3128 } // namespace
OLDNEW
« no previous file with comments | « Source/core/html/HTMLMetaElement-in.cpp ('k') | Source/web/tests/data/viewport/viewport-warnings-7.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698