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

Side by Side Diff: ui/views/cocoa/cocoa_mouse_capture_unittest.mm

Issue 1868363002: Replace scoped_ptr with std::unique_ptr in //ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@scopedptrcc
Patch Set: scopedptrui: rebase-make_scoped_ptr Created 4 years, 8 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
« no previous file with comments | « ui/views/cocoa/cocoa_mouse_capture.h ('k') | ui/views/controls/button/blue_button.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #import "ui/views/cocoa/cocoa_mouse_capture.h" 5 #import "ui/views/cocoa/cocoa_mouse_capture.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #import "base/mac/scoped_nsobject.h" 9 #import "base/mac/scoped_nsobject.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 void SimulateDestroy() { mouse_capture_.reset(); } 43 void SimulateDestroy() { mouse_capture_.reset(); }
44 44
45 int event_count() { return event_count_; } 45 int event_count() { return event_count_; }
46 int capture_lost_count() { return capture_lost_count_; } 46 int capture_lost_count() { return capture_lost_count_; }
47 47
48 // CocoaMouseCaptureDelegate: 48 // CocoaMouseCaptureDelegate:
49 void PostCapturedEvent(NSEvent* event) override { ++event_count_; } 49 void PostCapturedEvent(NSEvent* event) override { ++event_count_; }
50 void OnMouseCaptureLost() override { ++capture_lost_count_; } 50 void OnMouseCaptureLost() override { ++capture_lost_count_; }
51 51
52 private: 52 private:
53 scoped_ptr<CocoaMouseCapture> mouse_capture_; 53 std::unique_ptr<CocoaMouseCapture> mouse_capture_;
54 int event_count_; 54 int event_count_;
55 int capture_lost_count_; 55 int capture_lost_count_;
56 56
57 DISALLOW_COPY_AND_ASSIGN(TestCaptureDelegate); 57 DISALLOW_COPY_AND_ASSIGN(TestCaptureDelegate);
58 }; 58 };
59 59
60 } // namespace 60 } // namespace
61 61
62 typedef ui::CocoaTest CocoaMouseCaptureTest; 62 typedef ui::CocoaTest CocoaMouseCaptureTest;
63 63
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 EXPECT_EQ(1, [view mouseDownCount]); 119 EXPECT_EQ(1, [view mouseDownCount]);
120 EXPECT_EQ(1, capture.event_count()); 120 EXPECT_EQ(1, capture.event_count());
121 } 121 }
122 122
123 // After the capture goes away, events should be received again. 123 // After the capture goes away, events should be received again.
124 [NSApp sendEvent:click.first]; 124 [NSApp sendEvent:click.first];
125 EXPECT_EQ(2, [view mouseDownCount]); 125 EXPECT_EQ(2, [view mouseDownCount]);
126 } 126 }
127 127
128 } // namespace views 128 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/cocoa/cocoa_mouse_capture.h ('k') | ui/views/controls/button/blue_button.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698