| OLD | NEW | 
|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" | 
| 8 #import "chrome/browser/ui/cocoa/clickhold_button_cell.h" | 8 #import "chrome/browser/ui/cocoa/clickhold_button_cell.h" | 
| 9 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 9 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" | 
| 11 #include "testing/platform_test.h" | 11 #include "testing/platform_test.h" | 
| 12 | 12 | 
| 13 namespace { | 13 namespace { | 
| 14 | 14 | 
| 15 class ClickHoldButtonCellTest : public CocoaTest { | 15 class ClickHoldButtonCellTest : public CocoaTest { | 
| 16  public: | 16  public: | 
| 17   ClickHoldButtonCellTest() { | 17   ClickHoldButtonCellTest() { | 
| 18     NSRect frame = NSMakeRect(0, 0, 50, 30); | 18     NSRect frame = NSMakeRect(0, 0, 50, 30); | 
| 19     scoped_nsobject<NSButton> view([[NSButton alloc] initWithFrame:frame]); | 19     base::scoped_nsobject<NSButton> view( | 
|  | 20         [[NSButton alloc] initWithFrame:frame]); | 
| 20     view_ = view.get(); | 21     view_ = view.get(); | 
| 21     scoped_nsobject<ClickHoldButtonCell> cell( | 22     base::scoped_nsobject<ClickHoldButtonCell> cell( | 
| 22         [[ClickHoldButtonCell alloc] initTextCell:@"Testing"]); | 23         [[ClickHoldButtonCell alloc] initTextCell:@"Testing"]); | 
| 23     [view_ setCell:cell.get()]; | 24     [view_ setCell:cell.get()]; | 
| 24     [[test_window() contentView] addSubview:view_]; | 25     [[test_window() contentView] addSubview:view_]; | 
| 25   } | 26   } | 
| 26 | 27 | 
| 27   NSButton* view_; | 28   NSButton* view_; | 
| 28 }; | 29 }; | 
| 29 | 30 | 
| 30 TEST_VIEW(ClickHoldButtonCellTest, view_) | 31 TEST_VIEW(ClickHoldButtonCellTest, view_) | 
| 31 | 32 | 
| (...skipping 10 matching lines...) Expand all  Loading... | 
| 42 | 43 | 
| 43   EXPECT_FALSE([cell trackOnlyInRect]); | 44   EXPECT_FALSE([cell trackOnlyInRect]); | 
| 44   EXPECT_TRUE([cell activateOnDrag]); | 45   EXPECT_TRUE([cell activateOnDrag]); | 
| 45 } | 46 } | 
| 46 | 47 | 
| 47 // TODO(viettrungluu): (1) Enable click-hold and figure out how to test the | 48 // TODO(viettrungluu): (1) Enable click-hold and figure out how to test the | 
| 48 // tracking loop (i.e., |-trackMouse:...|), which is the nontrivial part. | 49 // tracking loop (i.e., |-trackMouse:...|), which is the nontrivial part. | 
| 49 // (2) Test various initialization code paths (in particular, loading from nib). | 50 // (2) Test various initialization code paths (in particular, loading from nib). | 
| 50 | 51 | 
| 51 }  // namespace | 52 }  // namespace | 
| OLD | NEW | 
|---|