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 "chrome/browser/ui/toolbar/app_menu_model.h" | 5 #include "chrome/browser/ui/toolbar/app_menu_model.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
10 #include "chrome/browser/defaults.h" | 10 #include "chrome/browser/defaults.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 TestingBrowserProcess::GetGlobal()->SetLocalState(prefs_.get()); | 72 TestingBrowserProcess::GetGlobal()->SetLocalState(prefs_.get()); |
73 testing_io_thread_state_.reset(new chrome::TestingIOThreadState()); | 73 testing_io_thread_state_.reset(new chrome::TestingIOThreadState()); |
74 BrowserWithTestWindowTest::SetUp(); | 74 BrowserWithTestWindowTest::SetUp(); |
75 } | 75 } |
76 | 76 |
77 void TearDown() override { | 77 void TearDown() override { |
78 BrowserWithTestWindowTest::TearDown(); | 78 BrowserWithTestWindowTest::TearDown(); |
79 testing_io_thread_state_.reset(); | 79 testing_io_thread_state_.reset(); |
80 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); | 80 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); |
81 DestroyBrowserAndProfile(); | |
82 } | 81 } |
83 | 82 |
84 private: | 83 private: |
85 std::unique_ptr<TestingPrefServiceSimple> prefs_; | 84 std::unique_ptr<TestingPrefServiceSimple> prefs_; |
86 std::unique_ptr<chrome::TestingIOThreadState> testing_io_thread_state_; | 85 std::unique_ptr<chrome::TestingIOThreadState> testing_io_thread_state_; |
87 }; | 86 }; |
88 | 87 |
89 // Copies parts of MenuModelTest::Delegate and combines them with the | 88 // Copies parts of MenuModelTest::Delegate and combines them with the |
90 // AppMenuModel since AppMenuModel is now a SimpleMenuModel::Delegate and | 89 // AppMenuModel since AppMenuModel is now a SimpleMenuModel::Delegate and |
91 // not derived from SimpleMenuModel. | 90 // not derived from SimpleMenuModel. |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 EXPECT_TRUE(model.IsEnabledAt(index1)); | 194 EXPECT_TRUE(model.IsEnabledAt(index1)); |
196 EXPECT_EQ(0, error1->execute_count()); | 195 EXPECT_EQ(0, error1->execute_count()); |
197 model.ActivatedAt(index1); | 196 model.ActivatedAt(index1); |
198 EXPECT_EQ(1, error1->execute_count()); | 197 EXPECT_EQ(1, error1->execute_count()); |
199 | 198 |
200 EXPECT_TRUE(model.IsEnabledAt(index2)); | 199 EXPECT_TRUE(model.IsEnabledAt(index2)); |
201 EXPECT_EQ(0, error2->execute_count()); | 200 EXPECT_EQ(0, error2->execute_count()); |
202 model.ActivatedAt(index2); | 201 model.ActivatedAt(index2); |
203 EXPECT_EQ(1, error1->execute_count()); | 202 EXPECT_EQ(1, error1->execute_count()); |
204 } | 203 } |
OLD | NEW |