| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #include "base/scoped_nsobject.h" | 7 #include "base/scoped_nsobject.h" |
| 8 #import "chrome/browser/cocoa/find_pasteboard.h" | 8 #import "chrome/browser/cocoa/find_pasteboard.h" |
| 9 #import "chrome/browser/cocoa/cocoa_test_helper.h" | 9 #import "chrome/browser/cocoa/cocoa_test_helper.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 [pboard_ setString:text forType:NSStringPboardType]; | 55 [pboard_ setString:text forType:NSStringPboardType]; |
| 56 } | 56 } |
| 57 | 57 |
| 58 - (NSString*)findPboardText { | 58 - (NSString*)findPboardText { |
| 59 return [pboard_ stringForType:NSStringPboardType]; | 59 return [pboard_ stringForType:NSStringPboardType]; |
| 60 } | 60 } |
| 61 @end | 61 @end |
| 62 | 62 |
| 63 namespace { | 63 namespace { |
| 64 | 64 |
| 65 class FindPasteboardTest : public PlatformTest { | 65 class FindPasteboardTest : public CocoaTest { |
| 66 public: | 66 public: |
| 67 FindPasteboardTest() { | 67 FindPasteboardTest() { |
| 68 pboard_.reset([[FindPasteboardTesting alloc] init]); | 68 pboard_.reset([[FindPasteboardTesting alloc] init]); |
| 69 } | 69 } |
| 70 protected: | 70 protected: |
| 71 CocoaTestHelper helper_; | |
| 72 scoped_nsobject<FindPasteboardTesting> pboard_; | 71 scoped_nsobject<FindPasteboardTesting> pboard_; |
| 73 }; | 72 }; |
| 74 | 73 |
| 75 TEST_F(FindPasteboardTest, SettingTextUpdatesPboard) { | 74 TEST_F(FindPasteboardTest, SettingTextUpdatesPboard) { |
| 76 [pboard_.get() setFindText:@"text"]; | 75 [pboard_.get() setFindText:@"text"]; |
| 77 EXPECT_EQ( | 76 EXPECT_EQ( |
| 78 NSOrderedSame, | 77 NSOrderedSame, |
| 79 [[pboard_.get() findPboardText] compare:@"text"]); | 78 [[pboard_.get() findPboardText] compare:@"text"]); |
| 80 } | 79 } |
| 81 | 80 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 107 | 106 |
| 108 [pboard_.get() setFindPboardText:@"otherer text"]; | 107 [pboard_.get() setFindPboardText:@"otherer text"]; |
| 109 [pboard_.get() loadTextFromPasteboard:nil]; | 108 [pboard_.get() loadTextFromPasteboard:nil]; |
| 110 EXPECT_EQ(3, pboard_.get()->notificationCount_); | 109 EXPECT_EQ(3, pboard_.get()->notificationCount_); |
| 111 | 110 |
| 112 [[NSNotificationCenter defaultCenter] removeObserver:pboard_.get()]; | 111 [[NSNotificationCenter defaultCenter] removeObserver:pboard_.get()]; |
| 113 } | 112 } |
| 114 | 113 |
| 115 | 114 |
| 116 } // namespace | 115 } // namespace |
| OLD | NEW |