| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #import "ios/chrome/browser/ui/tools_menu/tools_menu_view_controller.h" | 5 #import "ios/chrome/browser/ui/tools_menu/tools_menu_view_controller.h" |
| 6 | 6 |
| 7 #import "base/mac/scoped_nsobject.h" | 7 #import "base/mac/scoped_nsobject.h" |
| 8 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" | 8 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
| 9 #import "ios/chrome/browser/ui/tools_menu/tools_menu_configuration.h" | 9 #import "ios/chrome/browser/ui/tools_menu/tools_menu_configuration.h" |
| 10 #import "ios/chrome/browser/ui/tools_menu/tools_menu_view_item.h" | 10 #import "ios/chrome/browser/ui/tools_menu/tools_menu_view_item.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 ToolsMenuViewItem* desktop_item = | 62 ToolsMenuViewItem* desktop_item = |
| 63 GetToolsMenuViewItemWithTag(IDC_REQUEST_DESKTOP_SITE); | 63 GetToolsMenuViewItemWithTag(IDC_REQUEST_DESKTOP_SITE); |
| 64 ASSERT_TRUE(desktop_item); | 64 ASSERT_TRUE(desktop_item); |
| 65 EXPECT_TRUE(desktop_item.active); | 65 EXPECT_TRUE(desktop_item.active); |
| 66 | 66 |
| 67 ToolsMenuViewItem* mobile_item = | 67 ToolsMenuViewItem* mobile_item = |
| 68 GetToolsMenuViewItemWithTag(IDC_REQUEST_MOBILE_SITE); | 68 GetToolsMenuViewItemWithTag(IDC_REQUEST_MOBILE_SITE); |
| 69 EXPECT_FALSE(mobile_item); | 69 EXPECT_FALSE(mobile_item); |
| 70 } | 70 } |
| 71 | 71 |
| 72 // Tests that "Request Desktop Site" is visible and not enabled, and | 72 // Tests that "Request Desktop Site" is invisible, and "Request Mobile Site" is |
| 73 // "Request Mobile Site" is invisible when the current page is a web page and | 73 // visible and enabled when the current page is a web page and uses DESKTOP user |
| 74 // uses DESKTOP user agent. | 74 // agent. |
| 75 TEST_F(ToolsMenuViewControllerTest, TestUserAgentTypeDESKTOP) { | 75 TEST_F(ToolsMenuViewControllerTest, TestUserAgentTypeDESKTOP) { |
| 76 [configuration_ setUserAgentType:web::UserAgentType::DESKTOP]; | 76 [configuration_ setUserAgentType:web::UserAgentType::DESKTOP]; |
| 77 [controller_ initializeMenuWithConfiguration:configuration_.get()]; | 77 [controller_ initializeMenuWithConfiguration:configuration_.get()]; |
| 78 | 78 |
| 79 ToolsMenuViewItem* desktop_item = | 79 ToolsMenuViewItem* desktop_item = |
| 80 GetToolsMenuViewItemWithTag(IDC_REQUEST_DESKTOP_SITE); | 80 GetToolsMenuViewItemWithTag(IDC_REQUEST_DESKTOP_SITE); |
| 81 ASSERT_TRUE(desktop_item); | 81 EXPECT_FALSE(desktop_item); |
| 82 EXPECT_FALSE(desktop_item.active); | |
| 83 | 82 |
| 84 ToolsMenuViewItem* mobile_item = | 83 ToolsMenuViewItem* mobile_item = |
| 85 GetToolsMenuViewItemWithTag(IDC_REQUEST_MOBILE_SITE); | 84 GetToolsMenuViewItemWithTag(IDC_REQUEST_MOBILE_SITE); |
| 86 EXPECT_FALSE(mobile_item); | 85 ASSERT_TRUE(mobile_item); |
| 86 EXPECT_TRUE(mobile_item.active); |
| 87 } | 87 } |
| OLD | NEW |