| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "web/tests/sim/SimTest.h" | 5 #include "web/tests/sim/SimTest.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "platform/LayoutTestSupport.h" | 8 #include "platform/LayoutTestSupport.h" |
| 9 #include "platform/scroll/ScrollbarTheme.h" | 9 #include "platform/scroll/ScrollbarTheme.h" |
| 10 #include "public/web/WebCache.h" |
| 10 #include "web/WebLocalFrameImpl.h" | 11 #include "web/WebLocalFrameImpl.h" |
| 11 #include "web/WebViewImpl.h" | 12 #include "web/WebViewImpl.h" |
| 12 | 13 |
| 13 namespace blink { | 14 namespace blink { |
| 14 | 15 |
| 15 SimTest::SimTest() | 16 SimTest::SimTest() |
| 16 : m_webViewClient(m_compositor) | 17 : m_webViewClient(m_compositor) |
| 17 { | 18 { |
| 18 Document::setThreadedParsingEnabledForTesting(false); | 19 Document::setThreadedParsingEnabledForTesting(false); |
| 19 // Use the mock theme to get more predictable code paths, this also avoids | 20 // Use the mock theme to get more predictable code paths, this also avoids |
| 20 // the OS callbacks in ScrollAnimatorMac which can schedule frames | 21 // the OS callbacks in ScrollAnimatorMac which can schedule frames |
| 21 // unpredictably since the OS will randomly call into blink for | 22 // unpredictably since the OS will randomly call into blink for |
| 22 // updateScrollerStyleForNewRecommendedScrollerStyle which then does | 23 // updateScrollerStyleForNewRecommendedScrollerStyle which then does |
| 23 // FrameView::scrollbarStyleChanged and will adjust the scrollbar existence | 24 // FrameView::scrollbarStyleChanged and will adjust the scrollbar existence |
| 24 // in the middle of a test. | 25 // in the middle of a test. |
| 25 LayoutTestSupport::setMockThemeEnabledForTest(true); | 26 LayoutTestSupport::setMockThemeEnabledForTest(true); |
| 26 ScrollbarTheme::setMockScrollbarsEnabled(true); | 27 ScrollbarTheme::setMockScrollbarsEnabled(true); |
| 27 m_webViewHelper.initialize(true, nullptr, &m_webViewClient); | 28 m_webViewHelper.initialize(true, nullptr, &m_webViewClient); |
| 28 m_compositor.setWebViewImpl(webView()); | 29 m_compositor.setWebViewImpl(webView()); |
| 29 } | 30 } |
| 30 | 31 |
| 31 SimTest::~SimTest() | 32 SimTest::~SimTest() |
| 32 { | 33 { |
| 33 Document::setThreadedParsingEnabledForTesting(true); | 34 Document::setThreadedParsingEnabledForTesting(true); |
| 34 LayoutTestSupport::setMockThemeEnabledForTest(false); | 35 LayoutTestSupport::setMockThemeEnabledForTest(false); |
| 35 ScrollbarTheme::setMockScrollbarsEnabled(false); | 36 ScrollbarTheme::setMockScrollbarsEnabled(false); |
| 37 WebCache::clear(); |
| 36 } | 38 } |
| 37 | 39 |
| 38 void SimTest::loadURL(const String& url) | 40 void SimTest::loadURL(const String& url) |
| 39 { | 41 { |
| 40 WebURLRequest request; | 42 WebURLRequest request; |
| 41 request.initialize(); | 43 request.initialize(); |
| 42 request.setURL(KURL(ParsedURLString, url)); | 44 request.setURL(KURL(ParsedURLString, url)); |
| 43 webView().mainFrameImpl()->loadRequest(request); | 45 webView().mainFrameImpl()->loadRequest(request); |
| 44 } | 46 } |
| 45 | 47 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 57 { | 59 { |
| 58 return m_webViewClient; | 60 return m_webViewClient; |
| 59 } | 61 } |
| 60 | 62 |
| 61 SimCompositor& SimTest::compositor() | 63 SimCompositor& SimTest::compositor() |
| 62 { | 64 { |
| 63 return m_compositor; | 65 return m_compositor; |
| 64 } | 66 } |
| 65 | 67 |
| 66 } // namespace blink | 68 } // namespace blink |
| OLD | NEW |