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 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1492 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true)); | 1492 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(true)); |
1493 UpdateProviderPolicy(policies); | 1493 UpdateProviderPolicy(policies); |
1494 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_HOME)); | 1494 EXPECT_TRUE(chrome::ExecuteCommand(browser(), IDC_HOME)); |
1495 content::WaitForLoadStop(contents); | 1495 content::WaitForLoadStop(contents); |
1496 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), contents->GetURL()); | 1496 EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), contents->GetURL()); |
1497 } | 1497 } |
1498 | 1498 |
1499 IN_PROC_BROWSER_TEST_F(PolicyTest, IncognitoEnabled) { | 1499 IN_PROC_BROWSER_TEST_F(PolicyTest, IncognitoEnabled) { |
1500 // Verifies that incognito windows can't be opened when disabled by policy. | 1500 // Verifies that incognito windows can't be opened when disabled by policy. |
1501 | 1501 |
1502 // Only test this on the native desktop. | |
1503 const BrowserList* native_browser_list = | 1502 const BrowserList* native_browser_list = |
1504 BrowserList::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE); | 1503 BrowserList::GetInstance(chrome::GetActiveDesktop()); |
1505 | 1504 |
1506 // Disable incognito via policy and verify that incognito windows can't be | 1505 // Disable incognito via policy and verify that incognito windows can't be |
1507 // opened. | 1506 // opened. |
1508 EXPECT_EQ(1u, native_browser_list->size()); | 1507 EXPECT_EQ(1u, native_browser_list->size()); |
1509 EXPECT_FALSE(BrowserList::IsOffTheRecordSessionActive()); | 1508 EXPECT_FALSE(BrowserList::IsOffTheRecordSessionActive()); |
1510 PolicyMap policies; | 1509 PolicyMap policies; |
1511 policies.Set(key::kIncognitoEnabled, POLICY_LEVEL_MANDATORY, | 1510 policies.Set(key::kIncognitoEnabled, POLICY_LEVEL_MANDATORY, |
1512 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(false)); | 1511 POLICY_SCOPE_USER, base::Value::CreateBooleanValue(false)); |
1513 UpdateProviderPolicy(policies); | 1512 UpdateProviderPolicy(policies); |
1514 EXPECT_FALSE(chrome::ExecuteCommand(browser(), IDC_NEW_INCOGNITO_WINDOW)); | 1513 EXPECT_FALSE(chrome::ExecuteCommand(browser(), IDC_NEW_INCOGNITO_WINDOW)); |
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2465 chrome_variations::VariationsService::GetVariationsServerURL( | 2464 chrome_variations::VariationsService::GetVariationsServerURL( |
2466 g_browser_process->local_state()); | 2465 g_browser_process->local_state()); |
2467 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); | 2466 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); |
2468 std::string value; | 2467 std::string value; |
2469 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); | 2468 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); |
2470 EXPECT_EQ("restricted", value); | 2469 EXPECT_EQ("restricted", value); |
2471 } | 2470 } |
2472 #endif | 2471 #endif |
2473 | 2472 |
2474 } // namespace policy | 2473 } // namespace policy |
OLD | NEW |