| 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/wrench_menu_model.h" | 5 #include "chrome/browser/ui/toolbar/wrench_menu_model.h" |
| 6 | 6 |
| 7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
| 8 #include "chrome/browser/prefs/browser_prefs.h" | 8 #include "chrome/browser/prefs/browser_prefs.h" |
| 9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 9 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 class WrenchMenuModelTest : public BrowserWithTestWindowTest, | 54 class WrenchMenuModelTest : public BrowserWithTestWindowTest, |
| 55 public ui::AcceleratorProvider { | 55 public ui::AcceleratorProvider { |
| 56 public: | 56 public: |
| 57 // Don't handle accelerators. | 57 // Don't handle accelerators. |
| 58 bool GetAcceleratorForCommandId(int command_id, | 58 bool GetAcceleratorForCommandId(int command_id, |
| 59 ui::Accelerator* accelerator) override { | 59 ui::Accelerator* accelerator) override { |
| 60 return false; | 60 return false; |
| 61 } | 61 } |
| 62 | 62 |
| 63 protected: | 63 protected: |
| 64 virtual void SetUp() override { | 64 void SetUp() override { |
| 65 prefs_.reset(new TestingPrefServiceSimple()); | 65 prefs_.reset(new TestingPrefServiceSimple()); |
| 66 chrome::RegisterLocalState(prefs_->registry()); | 66 chrome::RegisterLocalState(prefs_->registry()); |
| 67 | 67 |
| 68 TestingBrowserProcess::GetGlobal()->SetLocalState(prefs_.get()); | 68 TestingBrowserProcess::GetGlobal()->SetLocalState(prefs_.get()); |
| 69 testing_io_thread_state_.reset(new chrome::TestingIOThreadState()); | 69 testing_io_thread_state_.reset(new chrome::TestingIOThreadState()); |
| 70 BrowserWithTestWindowTest::SetUp(); | 70 BrowserWithTestWindowTest::SetUp(); |
| 71 } | 71 } |
| 72 | 72 |
| 73 virtual void TearDown() override { | 73 void TearDown() override { |
| 74 BrowserWithTestWindowTest::TearDown(); | 74 BrowserWithTestWindowTest::TearDown(); |
| 75 testing_io_thread_state_.reset(); | 75 testing_io_thread_state_.reset(); |
| 76 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); | 76 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); |
| 77 DestroyBrowserAndProfile(); | 77 DestroyBrowserAndProfile(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 scoped_ptr<TestingPrefServiceSimple> prefs_; | 81 scoped_ptr<TestingPrefServiceSimple> prefs_; |
| 82 scoped_ptr<chrome::TestingIOThreadState> testing_io_thread_state_; | 82 scoped_ptr<chrome::TestingIOThreadState> testing_io_thread_state_; |
| 83 }; | 83 }; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 195 |
| 196 class EncodingMenuModelTest : public BrowserWithTestWindowTest, | 196 class EncodingMenuModelTest : public BrowserWithTestWindowTest, |
| 197 public MenuModelTest { | 197 public MenuModelTest { |
| 198 }; | 198 }; |
| 199 | 199 |
| 200 TEST_F(EncodingMenuModelTest, IsCommandIdCheckedWithNoTabs) { | 200 TEST_F(EncodingMenuModelTest, IsCommandIdCheckedWithNoTabs) { |
| 201 EncodingMenuModel model(browser()); | 201 EncodingMenuModel model(browser()); |
| 202 ASSERT_EQ(NULL, browser()->tab_strip_model()->GetActiveWebContents()); | 202 ASSERT_EQ(NULL, browser()->tab_strip_model()->GetActiveWebContents()); |
| 203 EXPECT_FALSE(model.IsCommandIdChecked(IDC_ENCODING_WINDOWS1252)); | 203 EXPECT_FALSE(model.IsCommandIdChecked(IDC_ENCODING_WINDOWS1252)); |
| 204 } | 204 } |
| OLD | NEW |