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

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

Issue 10908145: Converted policy.PolicyTest.testDisableSPDY pyauto test to browser_tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/net/net_pref_observer.cc ('k') | chrome/test/functional/policy.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string> 5 #include <string>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_path.h" 9 #include "base/file_path.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 #include "content/public/browser/notification_types.h" 55 #include "content/public/browser/notification_types.h"
56 #include "content/public/browser/render_view_host.h" 56 #include "content/public/browser/render_view_host.h"
57 #include "content/public/browser/web_contents.h" 57 #include "content/public/browser/web_contents.h"
58 #include "content/public/common/url_constants.h" 58 #include "content/public/common/url_constants.h"
59 #include "content/public/test/browser_test_utils.h" 59 #include "content/public/test/browser_test_utils.h"
60 #include "content/public/test/download_test_observer.h" 60 #include "content/public/test/download_test_observer.h"
61 #include "content/public/test/test_utils.h" 61 #include "content/public/test/test_utils.h"
62 #include "content/test/net/url_request_mock_http_job.h" 62 #include "content/test/net/url_request_mock_http_job.h"
63 #include "googleurl/src/gurl.h" 63 #include "googleurl/src/gurl.h"
64 #include "net/base/net_util.h" 64 #include "net/base/net_util.h"
65 #include "net/http/http_stream_factory.h"
65 #include "net/url_request/url_request.h" 66 #include "net/url_request/url_request.h"
66 #include "net/url_request/url_request_filter.h" 67 #include "net/url_request/url_request_filter.h"
67 #include "policy/policy_constants.h" 68 #include "policy/policy_constants.h"
68 #include "testing/gmock/include/gmock/gmock.h" 69 #include "testing/gmock/include/gmock/gmock.h"
69 #include "testing/gtest/include/gtest/gtest.h" 70 #include "testing/gtest/include/gtest/gtest.h"
70 71
71 #if defined(OS_CHROMEOS) 72 #if defined(OS_CHROMEOS)
72 #include "ash/accelerators/accelerator_controller.h" 73 #include "ash/accelerators/accelerator_controller.h"
73 #include "ash/accelerators/accelerator_table.h" 74 #include "ash/accelerators/accelerator_table.h"
74 #include "ash/shell.h" 75 #include "ash/shell.h"
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 // Enable with a policy. 426 // Enable with a policy.
426 policies.Set(key::kDisable3DAPIs, POLICY_LEVEL_MANDATORY, 427 policies.Set(key::kDisable3DAPIs, POLICY_LEVEL_MANDATORY,
427 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(false)); 428 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(false));
428 provider_.UpdateChromePolicy(policies); 429 provider_.UpdateChromePolicy(policies);
429 content::CrashTab(contents); 430 content::CrashTab(contents);
430 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_RELOAD)); 431 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_RELOAD));
431 EXPECT_TRUE(IsWebGLEnabled(contents)); 432 EXPECT_TRUE(IsWebGLEnabled(contents));
432 } 433 }
433 #endif 434 #endif
434 435
436 IN_PROC_BROWSER_TEST_F(PolicyTest, DisableSpdy) {
437 // Verifies that SPDY can be disable by policy.
438 EXPECT_TRUE(net::HttpStreamFactory::spdy_enabled());
439 PolicyMap policies;
440 policies.Set(key::kDisableSpdy, POLICY_LEVEL_MANDATORY,
441 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true));
442 provider_.UpdateChromePolicy(policies);
443 content::RunAllPendingInMessageLoop();
444 EXPECT_FALSE(net::HttpStreamFactory::spdy_enabled());
445 // Verify that it can be force-enabled too.
446 browser()->profile()->GetPrefs()->SetBoolean(prefs::kDisableSpdy, true);
447 policies.Set(key::kDisableSpdy, POLICY_LEVEL_MANDATORY,
448 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(false));
449 provider_.UpdateChromePolicy(policies);
450 content::RunAllPendingInMessageLoop();
451 EXPECT_TRUE(net::HttpStreamFactory::spdy_enabled());
452 }
453
435 IN_PROC_BROWSER_TEST_F(PolicyTest, DeveloperToolsDisabled) { 454 IN_PROC_BROWSER_TEST_F(PolicyTest, DeveloperToolsDisabled) {
436 // Verifies that access to the developer tools can be disabled. 455 // Verifies that access to the developer tools can be disabled.
437 456
438 // Open devtools. 457 // Open devtools.
439 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_DEV_TOOLS)); 458 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_DEV_TOOLS));
440 content::WebContents* contents = chrome::GetActiveWebContents(browser()); 459 content::WebContents* contents = chrome::GetActiveWebContents(browser());
441 EXPECT_TRUE(DevToolsWindow::GetDevToolsContents(contents)); 460 EXPECT_TRUE(DevToolsWindow::GetDevToolsContents(contents));
442 461
443 // Disable devtools via policy. 462 // Disable devtools via policy.
444 PolicyMap policies; 463 PolicyMap policies;
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
687 TestScreenshotFile(true); 706 TestScreenshotFile(true);
688 ASSERT_EQ(CountScreenshots(), screenshot_count + 1); 707 ASSERT_EQ(CountScreenshots(), screenshot_count + 1);
689 708
690 // Check if trying to take a screenshot fails when disabled by policy. 709 // Check if trying to take a screenshot fails when disabled by policy.
691 TestScreenshotFile(false); 710 TestScreenshotFile(false);
692 ASSERT_EQ(CountScreenshots(), screenshot_count + 1); 711 ASSERT_EQ(CountScreenshots(), screenshot_count + 1);
693 } 712 }
694 #endif 713 #endif
695 714
696 } // namespace policy 715 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/net/net_pref_observer.cc ('k') | chrome/test/functional/policy.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698