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

Side by Side Diff: third_party/WebKit/Source/core/page/ChromeClientTest.cpp

Issue 1686483002: Oilpan: Remove most WillBe types from the code base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
OLDNEW
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 "core/page/ChromeClient.h" 5 #include "core/page/ChromeClient.h"
6 6
7 #include "core/dom/Document.h" 7 #include "core/dom/Document.h"
8 #include "core/layout/HitTestResult.h" 8 #include "core/layout/HitTestResult.h"
9 #include "core/loader/EmptyClients.h" 9 #include "core/loader/EmptyClients.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 19 matching lines...) Expand all
30 } // anonymous namespace 30 } // anonymous namespace
31 31
32 class ChromeClientTest : public testing::Test { 32 class ChromeClientTest : public testing::Test {
33 }; 33 };
34 34
35 TEST_F(ChromeClientTest, SetToolTipFlood) 35 TEST_F(ChromeClientTest, SetToolTipFlood)
36 { 36 {
37 ChromeClientToolTipLogger logger; 37 ChromeClientToolTipLogger logger;
38 ChromeClient* client = &logger; 38 ChromeClient* client = &logger;
39 HitTestResult result(HitTestRequest(HitTestRequest::Move), LayoutPoint(10, 2 0)); 39 HitTestResult result(HitTestRequest(HitTestRequest::Move), LayoutPoint(10, 2 0));
40 RefPtrWillBeRawPtr<Document> doc = Document::create(); 40 RawPtr<Document> doc = Document::create();
41 RefPtrWillBeRawPtr<Element> element = HTMLElement::create(HTMLNames::divTag, *doc); 41 RawPtr<Element> element = HTMLElement::create(HTMLNames::divTag, *doc);
42 element->setAttribute(HTMLNames::titleAttr, "tooltip"); 42 element->setAttribute(HTMLNames::titleAttr, "tooltip");
43 result.setInnerNode(element.get()); 43 result.setInnerNode(element.get());
44 44
45 client->setToolTip(result); 45 client->setToolTip(result);
46 EXPECT_EQ("tooltip", logger.toolTipForLastSetToolTip()); 46 EXPECT_EQ("tooltip", logger.toolTipForLastSetToolTip());
47 47
48 // seToolTip(HitTestResult) again in the same condition. 48 // seToolTip(HitTestResult) again in the same condition.
49 logger.clearToolTipForLastSetToolTip(); 49 logger.clearToolTipForLastSetToolTip();
50 client->setToolTip(result); 50 client->setToolTip(result);
51 // setToolTip(String,TextDirection) should not be called. 51 // setToolTip(String,TextDirection) should not be called.
52 EXPECT_EQ(String(), logger.toolTipForLastSetToolTip()); 52 EXPECT_EQ(String(), logger.toolTipForLastSetToolTip());
53 53
54 // Cancel the tooltip, and setToolTip(HitTestResult) again. 54 // Cancel the tooltip, and setToolTip(HitTestResult) again.
55 client->clearToolTip(); 55 client->clearToolTip();
56 logger.clearToolTipForLastSetToolTip(); 56 logger.clearToolTipForLastSetToolTip();
57 client->setToolTip(result); 57 client->setToolTip(result);
58 // setToolTip(String,TextDirection) should not be called. 58 // setToolTip(String,TextDirection) should not be called.
59 EXPECT_EQ(String(), logger.toolTipForLastSetToolTip()); 59 EXPECT_EQ(String(), logger.toolTipForLastSetToolTip());
60 60
61 logger.clearToolTipForLastSetToolTip(); 61 logger.clearToolTipForLastSetToolTip();
62 element->setAttribute(HTMLNames::titleAttr, "updated"); 62 element->setAttribute(HTMLNames::titleAttr, "updated");
63 client->setToolTip(result); 63 client->setToolTip(result);
64 // setToolTip(String,TextDirection) should be called because tooltip string 64 // setToolTip(String,TextDirection) should be called because tooltip string
65 // is different from the last one. 65 // is different from the last one.
66 EXPECT_EQ("updated", logger.toolTipForLastSetToolTip()); 66 EXPECT_EQ("updated", logger.toolTipForLastSetToolTip());
67 } 67 }
68 68
69 } // namespace blink 69 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698