| OLD | NEW |
| 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 23 matching lines...) Expand all Loading... |
| 34 #include "core/frame/Settings.h" | 34 #include "core/frame/Settings.h" |
| 35 #include "core/page/Page.h" | 35 #include "core/page/Page.h" |
| 36 #include "platform/Length.h" | 36 #include "platform/Length.h" |
| 37 #include "platform/geometry/IntPoint.h" | 37 #include "platform/geometry/IntPoint.h" |
| 38 #include "platform/geometry/IntRect.h" | 38 #include "platform/geometry/IntRect.h" |
| 39 #include "platform/geometry/IntSize.h" | 39 #include "platform/geometry/IntSize.h" |
| 40 #include "platform/scroll/ScrollbarTheme.h" | 40 #include "platform/scroll/ScrollbarTheme.h" |
| 41 #include "platform/testing/URLTestHelpers.h" | 41 #include "platform/testing/URLTestHelpers.h" |
| 42 #include "platform/testing/UnitTestHelpers.h" | 42 #include "platform/testing/UnitTestHelpers.h" |
| 43 #include "public/platform/Platform.h" | 43 #include "public/platform/Platform.h" |
| 44 #include "public/platform/WebUnitTestSupport.h" | 44 #include "public/platform/WebURLLoaderMockFactory.h" |
| 45 #include "public/web/WebCache.h" |
| 45 #include "public/web/WebConsoleMessage.h" | 46 #include "public/web/WebConsoleMessage.h" |
| 46 #include "public/web/WebFrame.h" | 47 #include "public/web/WebFrame.h" |
| 47 #include "public/web/WebScriptSource.h" | 48 #include "public/web/WebScriptSource.h" |
| 48 #include "public/web/WebSettings.h" | 49 #include "public/web/WebSettings.h" |
| 49 #include "public/web/WebViewClient.h" | 50 #include "public/web/WebViewClient.h" |
| 50 #include "testing/gtest/include/gtest/gtest.h" | 51 #include "testing/gtest/include/gtest/gtest.h" |
| 51 #include "web/tests/FrameTestHelpers.h" | 52 #include "web/tests/FrameTestHelpers.h" |
| 52 | 53 |
| 53 namespace blink { | 54 namespace blink { |
| 54 | 55 |
| 55 using blink::testing::runPendingTasks; | 56 using blink::testing::runPendingTasks; |
| 56 | 57 |
| 57 class ViewportTest : public ::testing::Test { | 58 class ViewportTest : public ::testing::Test { |
| 58 protected: | 59 protected: |
| 59 ViewportTest() | 60 ViewportTest() |
| 60 : m_baseURL("http://www.test.com/") | 61 : m_baseURL("http://www.test.com/") |
| 61 , m_chromeURL("chrome://") | 62 , m_chromeURL("chrome://") |
| 62 { | 63 { |
| 63 } | 64 } |
| 64 | 65 |
| 65 ~ViewportTest() override | 66 ~ViewportTest() override |
| 66 { | 67 { |
| 67 Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); | 68 Platform::current()->getURLLoaderMockFactory()->unregisterAllURLs(); |
| 69 WebCache::clear(); |
| 68 } | 70 } |
| 69 | 71 |
| 70 void registerMockedHttpURLLoad(const std::string& fileName) | 72 void registerMockedHttpURLLoad(const std::string& fileName) |
| 71 { | 73 { |
| 72 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseU
RL.c_str()), WebString::fromUTF8(fileName.c_str())); | 74 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseU
RL.c_str()), WebString::fromUTF8(fileName.c_str())); |
| 73 } | 75 } |
| 74 | 76 |
| 75 void registerMockedChromeURLLoad(const std::string& fileName) | 77 void registerMockedChromeURLLoad(const std::string& fileName) |
| 76 { | 78 { |
| 77 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_chrom
eURL.c_str()), WebString::fromUTF8(fileName.c_str())); | 79 URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_chrom
eURL.c_str()), WebString::fromUTF8(fileName.c_str())); |
| (...skipping 2931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3009 FrameTestHelpers::WebViewHelper webViewHelper; | 3011 FrameTestHelpers::WebViewHelper webViewHelper; |
| 3010 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-warnings-7.ht
ml", true, &webFrameClient, 0, setViewportSettings); | 3012 webViewHelper.initializeAndLoad(m_baseURL + "viewport/viewport-warnings-7.ht
ml", true, &webFrameClient, 0, setViewportSettings); |
| 3011 | 3013 |
| 3012 Page* page = webViewHelper.webViewImpl()->page(); | 3014 Page* page = webViewHelper.webViewImpl()->page(); |
| 3013 runViewportTest(page, 320, 352); | 3015 runViewportTest(page, 320, 352); |
| 3014 | 3016 |
| 3015 EXPECT_EQ(0U, webFrameClient.messages.size()); | 3017 EXPECT_EQ(0U, webFrameClient.messages.size()); |
| 3016 } | 3018 } |
| 3017 | 3019 |
| 3018 } // namespace blink | 3020 } // namespace blink |
| OLD | NEW |