| 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 "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/defaults.h" | 9 #include "chrome/browser/defaults.h" |
| 10 #include "chrome/browser/prefs/browser_prefs.h" | 10 #include "chrome/browser/prefs/browser_prefs.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 } | 74 } |
| 75 | 75 |
| 76 void TearDown() override { | 76 void TearDown() override { |
| 77 BrowserWithTestWindowTest::TearDown(); | 77 BrowserWithTestWindowTest::TearDown(); |
| 78 testing_io_thread_state_.reset(); | 78 testing_io_thread_state_.reset(); |
| 79 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); | 79 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); |
| 80 DestroyBrowserAndProfile(); | 80 DestroyBrowserAndProfile(); |
| 81 } | 81 } |
| 82 | 82 |
| 83 private: | 83 private: |
| 84 scoped_ptr<TestingPrefServiceSimple> prefs_; | 84 std::unique_ptr<TestingPrefServiceSimple> prefs_; |
| 85 scoped_ptr<chrome::TestingIOThreadState> testing_io_thread_state_; | 85 std::unique_ptr<chrome::TestingIOThreadState> testing_io_thread_state_; |
| 86 }; | 86 }; |
| 87 | 87 |
| 88 // Copies parts of MenuModelTest::Delegate and combines them with the | 88 // Copies parts of MenuModelTest::Delegate and combines them with the |
| 89 // AppMenuModel since AppMenuModel is now a SimpleMenuModel::Delegate and | 89 // AppMenuModel since AppMenuModel is now a SimpleMenuModel::Delegate and |
| 90 // not derived from SimpleMenuModel. | 90 // not derived from SimpleMenuModel. |
| 91 class TestAppMenuModel : public AppMenuModel { | 91 class TestAppMenuModel : public AppMenuModel { |
| 92 public: | 92 public: |
| 93 TestAppMenuModel(ui::AcceleratorProvider* provider, Browser* browser) | 93 TestAppMenuModel(ui::AcceleratorProvider* provider, Browser* browser) |
| 94 : AppMenuModel(provider, browser), | 94 : AppMenuModel(provider, browser), |
| 95 execute_count_(0), | 95 execute_count_(0), |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 | 206 |
| 207 class EncodingMenuModelTest : public BrowserWithTestWindowTest, | 207 class EncodingMenuModelTest : public BrowserWithTestWindowTest, |
| 208 public MenuModelTest { | 208 public MenuModelTest { |
| 209 }; | 209 }; |
| 210 | 210 |
| 211 TEST_F(EncodingMenuModelTest, IsCommandIdCheckedWithNoTabs) { | 211 TEST_F(EncodingMenuModelTest, IsCommandIdCheckedWithNoTabs) { |
| 212 EncodingMenuModel model(browser()); | 212 EncodingMenuModel model(browser()); |
| 213 ASSERT_EQ(NULL, browser()->tab_strip_model()->GetActiveWebContents()); | 213 ASSERT_EQ(NULL, browser()->tab_strip_model()->GetActiveWebContents()); |
| 214 EXPECT_FALSE(model.IsCommandIdChecked(IDC_ENCODING_WINDOWS1252)); | 214 EXPECT_FALSE(model.IsCommandIdChecked(IDC_ENCODING_WINDOWS1252)); |
| 215 } | 215 } |
| OLD | NEW |