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

Side by Side Diff: Source/web/tests/ChromeClientImplTest.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/ActivityLoggerTest.cpp ('k') | Source/web/tests/CustomEventTest.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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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/page/Page.h" 33 #include "core/page/Page.h"
34 #include "public/web/WebFrameClient.h" 34 #include "public/web/WebFrameClient.h"
35 #include "public/web/WebInputEvent.h" 35 #include "public/web/WebInputEvent.h"
36 #include "public/web/WebLocalFrame.h" 36 #include "public/web/WebLocalFrame.h"
37 #include "public/web/WebView.h" 37 #include "public/web/WebView.h"
38 #include "public/web/WebViewClient.h" 38 #include "public/web/WebViewClient.h"
39 #include "web/WebViewImpl.h" 39 #include "web/WebViewImpl.h"
40 #include "web/tests/FrameTestHelpers.h" 40 #include "web/tests/FrameTestHelpers.h"
41 #include <gtest/gtest.h> 41 #include <gtest/gtest.h>
42 42
43 using namespace blink;
44
45 namespace blink { 43 namespace blink {
46 44
47 void setCurrentInputEventForTest(const WebInputEvent* event) 45 void setCurrentInputEventForTest(const WebInputEvent* event)
48 { 46 {
49 WebViewImpl::m_currentInputEvent = event; 47 WebViewImpl::m_currentInputEvent = event;
50 } 48 }
51 49
52 }
53
54 namespace { 50 namespace {
55 51
56 class TestWebViewClient : public FrameTestHelpers::TestWebViewClient { 52 class TestWebViewClient : public FrameTestHelpers::TestWebViewClient {
57 public: 53 public:
58 explicit TestWebViewClient(WebNavigationPolicy* target) : m_target(target) { } 54 explicit TestWebViewClient(WebNavigationPolicy* target) : m_target(target) { }
59 ~TestWebViewClient() { } 55 ~TestWebViewClient() override { }
60 56
61 virtual void show(WebNavigationPolicy policy) 57 void show(WebNavigationPolicy policy) override
62 { 58 {
63 *m_target = policy; 59 *m_target = policy;
64 } 60 }
65 61
66 private: 62 private:
67 WebNavigationPolicy* m_target; 63 WebNavigationPolicy* m_target;
68 }; 64 };
69 65
70 class TestWebFrameClient : public WebFrameClient { 66 class TestWebFrameClient : public WebFrameClient {
71 public: 67 public:
72 ~TestWebFrameClient() { } 68 ~TestWebFrameClient() override { }
73 }; 69 };
74 70
71 } // anonymous namespace
72
75 class GetNavigationPolicyTest : public testing::Test { 73 class GetNavigationPolicyTest : public testing::Test {
76 public: 74 public:
77 GetNavigationPolicyTest() 75 GetNavigationPolicyTest()
78 : m_result(WebNavigationPolicyIgnore) 76 : m_result(WebNavigationPolicyIgnore)
79 , m_webViewClient(&m_result) 77 , m_webViewClient(&m_result)
80 { 78 {
81 } 79 }
82 80
83 protected: 81 protected:
84 virtual void SetUp() 82 void SetUp() override
85 { 83 {
86 m_webView = toWebViewImpl(WebView::create(&m_webViewClient)); 84 m_webView = toWebViewImpl(WebView::create(&m_webViewClient));
87 m_mainFrame = WebLocalFrame::create(WebTreeScopeType::Document, &m_webFr ameClient); 85 m_mainFrame = WebLocalFrame::create(WebTreeScopeType::Document, &m_webFr ameClient);
88 m_webView->setMainFrame(m_mainFrame); 86 m_webView->setMainFrame(m_mainFrame);
89 m_chromeClientImpl = toChromeClientImpl(&m_webView->page()->chromeClient ()); 87 m_chromeClientImpl = toChromeClientImpl(&m_webView->page()->chromeClient ());
90 m_result = WebNavigationPolicyIgnore; 88 m_result = WebNavigationPolicyIgnore;
91 } 89 }
92 90
93 virtual void TearDown() 91 void TearDown() override
94 { 92 {
95 m_webView->close(); 93 m_webView->close();
96 m_mainFrame->close(); 94 m_mainFrame->close();
97 } 95 }
98 96
99 WebNavigationPolicy getNavigationPolicyWithMouseEvent(int modifiers, WebMous eEvent::Button button, bool asPopup) 97 WebNavigationPolicy getNavigationPolicyWithMouseEvent(int modifiers, WebMous eEvent::Button button, bool asPopup)
100 { 98 {
101 WebMouseEvent event; 99 WebMouseEvent event;
102 event.modifiers = modifiers; 100 event.modifiers = modifiers;
103 event.type = WebInputEvent::MouseUp; 101 event.type = WebInputEvent::MouseUp;
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 } 255 }
258 256
259 TEST_F(GetNavigationPolicyTest, NotResizableForcesPopup) 257 TEST_F(GetNavigationPolicyTest, NotResizableForcesPopup)
260 { 258 {
261 m_chromeClientImpl->setResizable(false); 259 m_chromeClientImpl->setResizable(false);
262 EXPECT_TRUE(isNavigationPolicyPopup()); 260 EXPECT_TRUE(isNavigationPolicyPopup());
263 m_chromeClientImpl->setResizable(true); 261 m_chromeClientImpl->setResizable(true);
264 EXPECT_FALSE(isNavigationPolicyPopup()); 262 EXPECT_FALSE(isNavigationPolicyPopup());
265 } 263 }
266 264
267 } // namespace 265 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/tests/ActivityLoggerTest.cpp ('k') | Source/web/tests/CustomEventTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698