| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 1328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1339 } | 1339 } |
| 1340 | 1340 |
| 1341 IN_PROC_BROWSER_TEST_F(PolicyTest, DeveloperToolsDisabled) { | 1341 IN_PROC_BROWSER_TEST_F(PolicyTest, DeveloperToolsDisabled) { |
| 1342 // Verifies that access to the developer tools can be disabled. | 1342 // Verifies that access to the developer tools can be disabled. |
| 1343 | 1343 |
| 1344 // Open devtools. | 1344 // Open devtools. |
| 1345 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_DEV_TOOLS)); | 1345 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_DEV_TOOLS)); |
| 1346 content::WebContents* contents = | 1346 content::WebContents* contents = |
| 1347 browser()->tab_strip_model()->GetActiveWebContents(); | 1347 browser()->tab_strip_model()->GetActiveWebContents(); |
| 1348 DevToolsWindow *devtools_window = | 1348 DevToolsWindow *devtools_window = |
| 1349 DevToolsWindow::GetDockedInstanceForInspectedTab(contents); | 1349 DevToolsWindow::GetInstanceForInspectedRenderViewHost( |
| 1350 contents->GetRenderViewHost()); |
| 1350 EXPECT_TRUE(devtools_window); | 1351 EXPECT_TRUE(devtools_window); |
| 1351 | 1352 |
| 1352 // Disable devtools via policy. | 1353 // Disable devtools via policy. |
| 1353 PolicyMap policies; | 1354 PolicyMap policies; |
| 1354 policies.Set(key::kDeveloperToolsDisabled, POLICY_LEVEL_MANDATORY, | 1355 policies.Set(key::kDeveloperToolsDisabled, POLICY_LEVEL_MANDATORY, |
| 1355 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true), NULL); | 1356 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true), NULL); |
| 1356 content::WindowedNotificationObserver close_observer( | 1357 content::WindowedNotificationObserver close_observer( |
| 1357 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 1358 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
| 1358 content::Source<content::WebContents>(devtools_window->web_contents())); | 1359 content::Source<content::WebContents>(devtools_window->web_contents())); |
| 1359 UpdateProviderPolicy(policies); | 1360 UpdateProviderPolicy(policies); |
| 1360 // wait for devtools close | 1361 // wait for devtools close |
| 1361 close_observer.Wait(); | 1362 close_observer.Wait(); |
| 1362 // The existing devtools window should have closed. | 1363 // The existing devtools window should have closed. |
| 1363 EXPECT_FALSE(DevToolsWindow::GetDockedInstanceForInspectedTab(contents)); | 1364 EXPECT_FALSE(DevToolsWindow::GetInstanceForInspectedRenderViewHost( |
| 1365 contents->GetRenderViewHost())); |
| 1364 // And it's not possible to open it again. | 1366 // And it's not possible to open it again. |
| 1365 EXPECT_FALSE(chrome::ExecuteCommand(browser(), IDC_DEV_TOOLS)); | 1367 EXPECT_FALSE(chrome::ExecuteCommand(browser(), IDC_DEV_TOOLS)); |
| 1366 EXPECT_FALSE(DevToolsWindow::GetDockedInstanceForInspectedTab(contents)); | 1368 EXPECT_FALSE(DevToolsWindow::GetInstanceForInspectedRenderViewHost( |
| 1369 contents->GetRenderViewHost())); |
| 1367 } | 1370 } |
| 1368 | 1371 |
| 1369 // TODO(samarth): remove along with rest of NTP4 code. | 1372 // TODO(samarth): remove along with rest of NTP4 code. |
| 1370 IN_PROC_BROWSER_TEST_F(PolicyTest, DISABLED_WebStoreIconHidden) { | 1373 IN_PROC_BROWSER_TEST_F(PolicyTest, DISABLED_WebStoreIconHidden) { |
| 1371 #if defined(OS_WIN) && defined(USE_ASH) | 1374 #if defined(OS_WIN) && defined(USE_ASH) |
| 1372 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 1375 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
| 1373 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 1376 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
| 1374 return; | 1377 return; |
| 1375 #endif | 1378 #endif |
| 1376 | 1379 |
| (...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2872 chrome_variations::VariationsService::GetVariationsServerURL( | 2875 chrome_variations::VariationsService::GetVariationsServerURL( |
| 2873 g_browser_process->local_state()); | 2876 g_browser_process->local_state()); |
| 2874 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); | 2877 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); |
| 2875 std::string value; | 2878 std::string value; |
| 2876 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); | 2879 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); |
| 2877 EXPECT_EQ("restricted", value); | 2880 EXPECT_EQ("restricted", value); |
| 2878 } | 2881 } |
| 2879 #endif | 2882 #endif |
| 2880 | 2883 |
| 2881 } // namespace policy | 2884 } // namespace policy |
| OLD | NEW |