Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(110)

Side by Side Diff: chrome/browser/policy/policy_browsertest.cc

Issue 108213012: [DevTools] Remove dock side knowledge from browser. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac tests Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 } 1361 }
1362 1362
1363 IN_PROC_BROWSER_TEST_F(PolicyTest, DeveloperToolsDisabled) { 1363 IN_PROC_BROWSER_TEST_F(PolicyTest, DeveloperToolsDisabled) {
1364 // Verifies that access to the developer tools can be disabled. 1364 // Verifies that access to the developer tools can be disabled.
1365 1365
1366 // Open devtools. 1366 // Open devtools.
1367 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_DEV_TOOLS)); 1367 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_DEV_TOOLS));
1368 content::WebContents* contents = 1368 content::WebContents* contents =
1369 browser()->tab_strip_model()->GetActiveWebContents(); 1369 browser()->tab_strip_model()->GetActiveWebContents();
1370 DevToolsWindow *devtools_window = 1370 DevToolsWindow *devtools_window =
1371 DevToolsWindow::GetDockedInstanceForInspectedTab(contents); 1371 DevToolsWindow::GetInstanceForInspectedRenderViewHost(
1372 contents->GetRenderViewHost());
1372 EXPECT_TRUE(devtools_window); 1373 EXPECT_TRUE(devtools_window);
1373 1374
1374 // Disable devtools via policy. 1375 // Disable devtools via policy.
1375 PolicyMap policies; 1376 PolicyMap policies;
1376 policies.Set(key::kDeveloperToolsDisabled, POLICY_LEVEL_MANDATORY, 1377 policies.Set(key::kDeveloperToolsDisabled, POLICY_LEVEL_MANDATORY,
1377 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true), NULL); 1378 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true), NULL);
1378 content::WindowedNotificationObserver close_observer( 1379 content::WindowedNotificationObserver close_observer(
1379 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, 1380 content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
1380 content::Source<content::WebContents>(devtools_window->web_contents())); 1381 content::Source<content::WebContents>(devtools_window->web_contents()));
1381 UpdateProviderPolicy(policies); 1382 UpdateProviderPolicy(policies);
1382 // wait for devtools close 1383 // wait for devtools close
1383 close_observer.Wait(); 1384 close_observer.Wait();
1384 // The existing devtools window should have closed. 1385 // The existing devtools window should have closed.
1385 EXPECT_FALSE(DevToolsWindow::GetDockedInstanceForInspectedTab(contents)); 1386 EXPECT_FALSE(DevToolsWindow::GetInstanceForInspectedRenderViewHost(
1387 contents->GetRenderViewHost()));
1386 // And it's not possible to open it again. 1388 // And it's not possible to open it again.
1387 EXPECT_FALSE(chrome::ExecuteCommand(browser(), IDC_DEV_TOOLS)); 1389 EXPECT_FALSE(chrome::ExecuteCommand(browser(), IDC_DEV_TOOLS));
1388 EXPECT_FALSE(DevToolsWindow::GetDockedInstanceForInspectedTab(contents)); 1390 EXPECT_FALSE(DevToolsWindow::GetInstanceForInspectedRenderViewHost(
1391 contents->GetRenderViewHost()));
1389 } 1392 }
1390 1393
1391 // TODO(samarth): remove along with rest of NTP4 code. 1394 // TODO(samarth): remove along with rest of NTP4 code.
1392 IN_PROC_BROWSER_TEST_F(PolicyTest, DISABLED_WebStoreIconHidden) { 1395 IN_PROC_BROWSER_TEST_F(PolicyTest, DISABLED_WebStoreIconHidden) {
1393 #if defined(OS_WIN) && defined(USE_ASH) 1396 #if defined(OS_WIN) && defined(USE_ASH)
1394 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 1397 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
1395 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) 1398 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests))
1396 return; 1399 return;
1397 #endif 1400 #endif
1398 1401
(...skipping 1545 matching lines...) Expand 10 before | Expand all | Expand 10 after
2944 PrefService* prefs = browser()->profile()->GetPrefs(); 2947 PrefService* prefs = browser()->profile()->GetPrefs();
2945 EXPECT_TRUE(extensions::NativeMessageProcessHost::IsHostAllowed( 2948 EXPECT_TRUE(extensions::NativeMessageProcessHost::IsHostAllowed(
2946 prefs, "host.name")); 2949 prefs, "host.name"));
2947 EXPECT_FALSE(extensions::NativeMessageProcessHost::IsHostAllowed( 2950 EXPECT_FALSE(extensions::NativeMessageProcessHost::IsHostAllowed(
2948 prefs, "other.host.name")); 2951 prefs, "other.host.name"));
2949 } 2952 }
2950 2953
2951 #endif // !defined(CHROME_OS) 2954 #endif // !defined(CHROME_OS)
2952 2955
2953 } // namespace policy 2956 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698