| 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 1352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1363 DevToolsWindow::GetInstanceForInspectedRenderViewHost( | 1363 DevToolsWindow::GetInstanceForInspectedRenderViewHost( |
| 1364 contents->GetRenderViewHost()); | 1364 contents->GetRenderViewHost()); |
| 1365 EXPECT_TRUE(devtools_window); | 1365 EXPECT_TRUE(devtools_window); |
| 1366 | 1366 |
| 1367 // Disable devtools via policy. | 1367 // Disable devtools via policy. |
| 1368 PolicyMap policies; | 1368 PolicyMap policies; |
| 1369 policies.Set(key::kDeveloperToolsDisabled, POLICY_LEVEL_MANDATORY, | 1369 policies.Set(key::kDeveloperToolsDisabled, POLICY_LEVEL_MANDATORY, |
| 1370 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true), NULL); | 1370 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true), NULL); |
| 1371 content::WindowedNotificationObserver close_observer( | 1371 content::WindowedNotificationObserver close_observer( |
| 1372 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 1372 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
| 1373 content::Source<content::WebContents>(devtools_window->web_contents())); | 1373 content::Source<content::WebContents>( |
| 1374 devtools_window->web_contents_for_test())); |
| 1374 UpdateProviderPolicy(policies); | 1375 UpdateProviderPolicy(policies); |
| 1375 // wait for devtools close | 1376 // wait for devtools close |
| 1376 close_observer.Wait(); | 1377 close_observer.Wait(); |
| 1377 // The existing devtools window should have closed. | 1378 // The existing devtools window should have closed. |
| 1378 EXPECT_FALSE(DevToolsWindow::GetInstanceForInspectedRenderViewHost( | 1379 EXPECT_FALSE(DevToolsWindow::GetInstanceForInspectedRenderViewHost( |
| 1379 contents->GetRenderViewHost())); | 1380 contents->GetRenderViewHost())); |
| 1380 // And it's not possible to open it again. | 1381 // And it's not possible to open it again. |
| 1381 EXPECT_FALSE(chrome::ExecuteCommand(browser(), IDC_DEV_TOOLS)); | 1382 EXPECT_FALSE(chrome::ExecuteCommand(browser(), IDC_DEV_TOOLS)); |
| 1382 EXPECT_FALSE(DevToolsWindow::GetInstanceForInspectedRenderViewHost( | 1383 EXPECT_FALSE(DevToolsWindow::GetInstanceForInspectedRenderViewHost( |
| 1383 contents->GetRenderViewHost())); | 1384 contents->GetRenderViewHost())); |
| (...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2970 PrefService* prefs = browser()->profile()->GetPrefs(); | 2971 PrefService* prefs = browser()->profile()->GetPrefs(); |
| 2971 EXPECT_TRUE(extensions::NativeMessageProcessHost::IsHostAllowed( | 2972 EXPECT_TRUE(extensions::NativeMessageProcessHost::IsHostAllowed( |
| 2972 prefs, "host.name")); | 2973 prefs, "host.name")); |
| 2973 EXPECT_FALSE(extensions::NativeMessageProcessHost::IsHostAllowed( | 2974 EXPECT_FALSE(extensions::NativeMessageProcessHost::IsHostAllowed( |
| 2974 prefs, "other.host.name")); | 2975 prefs, "other.host.name")); |
| 2975 } | 2976 } |
| 2976 | 2977 |
| 2977 #endif // !defined(CHROME_OS) | 2978 #endif // !defined(CHROME_OS) |
| 2978 | 2979 |
| 2979 } // namespace policy | 2980 } // namespace policy |
| OLD | NEW |