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

Unified Diff: content/browser/renderer_host/render_widget_host_view_mac_unittest.mm

Issue 10831006: Introduce unittest for passing NULL pointer for actual_range. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: CL for review Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_widget_host_view_mac_unittest.mm
diff --git a/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm b/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm
index 6f140ba0f6557b726e1bab7709b0faaaeff9a816..5ad0070675a68487f3fff385c1eafe04aa6dc7d0 100644
--- a/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm
+++ b/content/browser/renderer_host/render_widget_host_view_mac_unittest.mm
@@ -337,8 +337,14 @@ TEST_F(RenderWidgetHostViewMacTest, UpdateCompositionSinglelineCase) {
const gfx::Point kOrigin(10, 11);
const gfx::Size kBoundsUnit(10, 20);
- // If there are no update from renderer, always returned caret position.
NSRect rect;
+ // Make sure not crashing by passing NULL pointer instead of |actual_range|.
+ EXPECT_FALSE(rwhv_mac_->GetCachedFirstRectForCharacterRange(
+ ui::Range(0, 0).ToNSRange(),
+ &rect,
+ NULL));
+
+ // If there are no update from renderer, always returned caret position.
NSRange actual_range;
EXPECT_FALSE(rwhv_mac_->GetCachedFirstRectForCharacterRange(
ui::Range(0, 0).ToNSRange(),
@@ -415,6 +421,13 @@ TEST_F(RenderWidgetHostViewMacTest, UpdateCompositionSinglelineCase) {
&actual_range));
EXPECT_EQ(ui::Range(request_range), ui::Range(actual_range));
EXPECT_EQ(expected_rect, gfx::Rect(NSRectToCGRect(rect)));
+
+ // Make sure not crashing by passing NULL pointer instead of
+ // |actual_range|.
+ EXPECT_TRUE(rwhv_mac_->GetCachedFirstRectForCharacterRange(
+ request_range,
+ &rect,
+ NULL));
}
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698