OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/memory/scoped_nsobject.h" | 5 #include "base/memory/scoped_nsobject.h" |
6 #include "base/sys_string_conversions.h" | 6 #include "base/sys_string_conversions.h" |
7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
9 #include "chrome/browser/sync/glue/session_model_associator.h" | 9 #include "chrome/browser/sync/glue/session_model_associator.h" |
10 #include "chrome/browser/sync/profile_sync_service_factory.h" | 10 #include "chrome/browser/sync/profile_sync_service_factory.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 // seems that the vector of observers is getting hosed somewhere between | 37 // seems that the vector of observers is getting hosed somewhere between |
38 // |-[ToolbarController dealloc]| and ~MockWrenchMenuModel(). This line | 38 // |-[ToolbarController dealloc]| and ~MockWrenchMenuModel(). This line |
39 // short-circuits the parent destructor to avoid this crash. | 39 // short-circuits the parent destructor to avoid this crash. |
40 tab_strip_model_ = NULL; | 40 tab_strip_model_ = NULL; |
41 } | 41 } |
42 MOCK_METHOD1(ExecuteCommand, void(int command_id)); | 42 MOCK_METHOD1(ExecuteCommand, void(int command_id)); |
43 }; | 43 }; |
44 | 44 |
45 class WrenchMenuControllerTest : public CocoaProfileTest { | 45 class WrenchMenuControllerTest : public CocoaProfileTest { |
46 public: | 46 public: |
47 virtual void SetUp() { | 47 virtual void SetUp() OVERRIDE { |
48 CocoaProfileTest::SetUp(); | 48 CocoaProfileTest::SetUp(); |
49 ASSERT_TRUE(browser()); | 49 ASSERT_TRUE(browser()); |
50 | 50 |
51 controller_.reset([[WrenchMenuController alloc] initWithBrowser:browser()]); | 51 controller_.reset([[WrenchMenuController alloc] initWithBrowser:browser()]); |
52 fake_model_.reset(new MockWrenchMenuModel); | 52 fake_model_.reset(new MockWrenchMenuModel); |
53 } | 53 } |
54 | 54 |
| 55 virtual void TearDown() OVERRIDE { |
| 56 fake_model_.reset(); |
| 57 controller_.reset(); |
| 58 CocoaProfileTest::TearDown(); |
| 59 } |
| 60 |
55 WrenchMenuController* controller() { | 61 WrenchMenuController* controller() { |
56 return controller_.get(); | 62 return controller_.get(); |
57 } | 63 } |
58 | 64 |
59 scoped_nsobject<WrenchMenuController> controller_; | 65 scoped_nsobject<WrenchMenuController> controller_; |
60 | 66 |
61 scoped_ptr<MockWrenchMenuModel> fake_model_; | 67 scoped_ptr<MockWrenchMenuModel> fake_model_; |
62 }; | 68 }; |
63 | 69 |
64 TEST_F(WrenchMenuControllerTest, Initialized) { | 70 TEST_F(WrenchMenuControllerTest, Initialized) { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 | 190 |
185 // Verify that |RecentTabsMenuModelDelegate| is deleted before the model | 191 // Verify that |RecentTabsMenuModelDelegate| is deleted before the model |
186 // it's observing. | 192 // it's observing. |
187 TEST_F(WrenchMenuControllerTest, RecentTabDeleteOrder) { | 193 TEST_F(WrenchMenuControllerTest, RecentTabDeleteOrder) { |
188 chrome::search::EnableInstantExtendedAPIForTesting(); | 194 chrome::search::EnableInstantExtendedAPIForTesting(); |
189 [controller_ menuNeedsUpdate:[controller_ menu]]; | 195 [controller_ menuNeedsUpdate:[controller_ menu]]; |
190 // If the delete order is wrong then the test will crash on exit. | 196 // If the delete order is wrong then the test will crash on exit. |
191 } | 197 } |
192 | 198 |
193 } // namespace | 199 } // namespace |
OLD | NEW |