| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/command_line.h" | |
| 6 #include "base/file_path.h" | |
| 7 #include "chrome/browser/browser.h" | |
| 8 #include "chrome/browser/tab_contents/tab_contents.h" | |
| 9 #include "chrome/common/chrome_switches.h" | |
| 10 #include "chrome/test/in_process_browser_test.h" | |
| 11 #include "chrome/test/ui_test_utils.h" | |
| 12 | |
| 13 class DeviceOrientationEnableSwitchTest : public InProcessBrowserTest { | |
| 14 public: | |
| 15 GURL testUrl(const FilePath::CharType* filename) { | |
| 16 const FilePath kTestDir(FILE_PATH_LITERAL("device_orientation")); | |
| 17 return ui_test_utils::GetTestUrl(kTestDir, FilePath(filename)); | |
| 18 } | |
| 19 }; | |
| 20 | |
| 21 IN_PROC_BROWSER_TEST_F(DeviceOrientationEnableSwitchTest, UnavailabilityTest) { | |
| 22 // Test that device orientation is not available to a web page if | |
| 23 // the runtime switch is disabled. | |
| 24 | |
| 25 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
| 26 bool has_switch = command_line.HasSwitch(switches::kEnableDeviceOrientation); | |
| 27 ASSERT_FALSE(has_switch) << "This test does not make sense if " | |
| 28 << "--enable-device-orientation is set."; | |
| 29 | |
| 30 GURL test_url = testUrl(FILE_PATH_LITERAL("enable_switch_test.html")); | |
| 31 ui_test_utils::NavigateToURL(browser(), test_url); | |
| 32 std::string status = browser()->GetSelectedTabContents()->GetURL().ref(); | |
| 33 EXPECT_EQ("pass", status) << "Page detected device orientation properties."; | |
| 34 } | |
| OLD | NEW |