| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 DISALLOW_COPY_AND_ASSIGN(MenuError); | 52 DISALLOW_COPY_AND_ASSIGN(MenuError); |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 } // namespace | 55 } // namespace |
| 56 | 56 |
| 57 class AppMenuModelTest : public BrowserWithTestWindowTest, | 57 class AppMenuModelTest : public BrowserWithTestWindowTest, |
| 58 public ui::AcceleratorProvider { | 58 public ui::AcceleratorProvider { |
| 59 public: | 59 public: |
| 60 // Don't handle accelerators. | 60 // Don't handle accelerators. |
| 61 bool GetAcceleratorForCommandId(int command_id, | 61 bool GetAcceleratorForCommandId(int command_id, |
| 62 ui::Accelerator* accelerator) override { | 62 ui::Accelerator* accelerator) const override { |
| 63 return false; | 63 return false; |
| 64 } | 64 } |
| 65 | 65 |
| 66 protected: | 66 protected: |
| 67 void SetUp() override { | 67 void SetUp() override { |
| 68 prefs_.reset(new TestingPrefServiceSimple()); | 68 prefs_.reset(new TestingPrefServiceSimple()); |
| 69 chrome::RegisterLocalState(prefs_->registry()); | 69 chrome::RegisterLocalState(prefs_->registry()); |
| 70 | 70 |
| 71 TestingBrowserProcess::GetGlobal()->SetLocalState(prefs_.get()); | 71 TestingBrowserProcess::GetGlobal()->SetLocalState(prefs_.get()); |
| 72 testing_io_thread_state_.reset(new chrome::TestingIOThreadState()); | 72 testing_io_thread_state_.reset(new chrome::TestingIOThreadState()); |
| (...skipping 133 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 |