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

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

Issue 1174283002: Fix unit test style in Source/web/. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove static Created 5 years, 6 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 | « Source/web/tests/TextFinderTest.cpp ('k') | Source/web/tests/TouchActionTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2015 Google Inc. All rights reserved. 2 * Copyright (C) 2015 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 22 matching lines...) Expand all
33 #include "core/frame/FrameHost.h" 33 #include "core/frame/FrameHost.h"
34 #include "core/frame/LocalFrame.h" 34 #include "core/frame/LocalFrame.h"
35 #include "core/layout/LayoutView.h" 35 #include "core/layout/LayoutView.h"
36 #include "core/page/Page.h" 36 #include "core/page/Page.h"
37 #include "platform/testing/URLTestHelpers.h" 37 #include "platform/testing/URLTestHelpers.h"
38 #include "public/platform/Platform.h" 38 #include "public/platform/Platform.h"
39 #include "public/platform/WebUnitTestSupport.h" 39 #include "public/platform/WebUnitTestSupport.h"
40 #include "public/web/WebSettings.h" 40 #include "public/web/WebSettings.h"
41 #include "web/WebLocalFrameImpl.h" 41 #include "web/WebLocalFrameImpl.h"
42 #include "web/tests/FrameTestHelpers.h" 42 #include "web/tests/FrameTestHelpers.h"
43
44 #include <gmock/gmock.h> 43 #include <gmock/gmock.h>
45 #include <gtest/gtest.h> 44 #include <gtest/gtest.h>
46 45
47 using namespace blink; 46 namespace blink {
48
49 namespace {
50 47
51 // These tests cover top controls scrolling on main-thread. 48 // These tests cover top controls scrolling on main-thread.
52 // The animation for completing a partial show/hide is done in compositor so 49 // The animation for completing a partial show/hide is done in compositor so
53 // it is not covered here. 50 // it is not covered here.
54 class TopControlsTest : public testing::Test { 51 class TopControlsTest : public testing::Test {
55 public: 52 public:
56 TopControlsTest() 53 TopControlsTest()
57 : m_baseURL("http://www.test.com/") 54 : m_baseURL("http://www.test.com/")
58 { 55 {
59 registerMockedHttpURLLoad("large-div.html"); 56 registerMockedHttpURLLoad("large-div.html");
60 registerMockedHttpURLLoad("overflow-scrolling.html"); 57 registerMockedHttpURLLoad("overflow-scrolling.html");
61 registerMockedHttpURLLoad("iframe-scrolling.html"); 58 registerMockedHttpURLLoad("iframe-scrolling.html");
62 registerMockedHttpURLLoad("iframe-scrolling-inner.html"); 59 registerMockedHttpURLLoad("iframe-scrolling-inner.html");
63 } 60 }
64 61
65 ~TopControlsTest() 62 ~TopControlsTest() override
66 { 63 {
67 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); 64 Platform::current()->unitTestSupport()->unregisterAllMockedURLs();
68 } 65 }
69 66
70 WebViewImpl* initialize(const std::string& pageName = "large-div.html") 67 WebViewImpl* initialize(const std::string& pageName = "large-div.html")
71 { 68 {
72 // Load a page with large body and set viewport size to 400x400 to ensur e 69 // Load a page with large body and set viewport size to 400x400 to ensur e
73 // main frame is scrollable. 70 // main frame is scrollable.
74 m_helper.initializeAndLoad(m_baseURL + pageName, true, 0, 0, &configureS ettings); 71 m_helper.initializeAndLoad(m_baseURL + pageName, true, 0, 0, &configureS ettings);
75 72
(...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 // Both states are permitted so controls can either show or hide 542 // Both states are permitted so controls can either show or hide
546 verticalScroll(50.f); 543 verticalScroll(50.f);
547 EXPECT_FLOAT_EQ(50, webView->topControls().contentOffset()); 544 EXPECT_FLOAT_EQ(50, webView->topControls().contentOffset());
548 EXPECT_POINT_EQ(IntPoint(0, 90), frame()->view()->scrollPosition()); 545 EXPECT_POINT_EQ(IntPoint(0, 90), frame()->view()->scrollPosition());
549 546
550 verticalScroll(-50.f); 547 verticalScroll(-50.f);
551 EXPECT_FLOAT_EQ(0, webView->topControls().contentOffset()); 548 EXPECT_FLOAT_EQ(0, webView->topControls().contentOffset());
552 EXPECT_POINT_EQ(IntPoint(0, 90), frame()->view()->scrollPosition()); 549 EXPECT_POINT_EQ(IntPoint(0, 90), frame()->view()->scrollPosition());
553 } 550 }
554 551
555 } // namespace 552 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/tests/TextFinderTest.cpp ('k') | Source/web/tests/TouchActionTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698