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

Side by Side Diff: chrome/browser/ui/startup/startup_browser_creator_browsertest.cc

Issue 1348903007: Revert of Add source column to chrome://policy showing the origins of policies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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 7
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/prefs/pref_service.h" 10 #include "base/prefs/pref_service.h"
(...skipping 1580 matching lines...) Expand 10 before | Expand all | Expand 10 after
1591 browser()->profile()->GetPrefs()->SetBoolean( 1591 browser()->profile()->GetPrefs()->SetBoolean(
1592 prefs::kSignInPromoShowOnFirstRunAllowed, true); 1592 prefs::kSignInPromoShowOnFirstRunAllowed, true);
1593 1593
1594 // Set the following user policies: 1594 // Set the following user policies:
1595 // * RestoreOnStartup = RestoreOnStartupIsURLs 1595 // * RestoreOnStartup = RestoreOnStartupIsURLs
1596 // * RestoreOnStartupURLs = [ "files/title1.html" ] 1596 // * RestoreOnStartupURLs = [ "files/title1.html" ]
1597 policy_map_.Set( 1597 policy_map_.Set(
1598 policy::key::kRestoreOnStartup, 1598 policy::key::kRestoreOnStartup,
1599 policy::POLICY_LEVEL_MANDATORY, 1599 policy::POLICY_LEVEL_MANDATORY,
1600 policy::POLICY_SCOPE_USER, 1600 policy::POLICY_SCOPE_USER,
1601 policy::POLICY_SOURCE_CLOUD,
1602 new base::FundamentalValue(SessionStartupPref::kPrefValueURLs), 1601 new base::FundamentalValue(SessionStartupPref::kPrefValueURLs),
1603 NULL); 1602 NULL);
1604 base::ListValue startup_urls; 1603 base::ListValue startup_urls;
1605 startup_urls.Append( 1604 startup_urls.Append(
1606 new base::StringValue(test_server()->GetURL("files/title1.html").spec())); 1605 new base::StringValue(test_server()->GetURL("files/title1.html").spec()));
1607 policy_map_.Set(policy::key::kRestoreOnStartupURLs, 1606 policy_map_.Set(policy::key::kRestoreOnStartupURLs,
1608 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, 1607 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER,
1609 policy::POLICY_SOURCE_CLOUD, startup_urls.DeepCopy(), 1608 startup_urls.DeepCopy(), NULL);
1610 nullptr);
1611 provider_.UpdateChromePolicy(policy_map_); 1609 provider_.UpdateChromePolicy(policy_map_);
1612 base::RunLoop().RunUntilIdle(); 1610 base::RunLoop().RunUntilIdle();
1613 1611
1614 // Do a process-startup browser launch. 1612 // Do a process-startup browser launch.
1615 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); 1613 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
1616 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, 1614 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator,
1617 chrome::startup::IS_FIRST_RUN); 1615 chrome::startup::IS_FIRST_RUN);
1618 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true, 1616 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true,
1619 browser()->host_desktop_type())); 1617 browser()->host_desktop_type()));
1620 1618
1621 // This should have created a new browser window. 1619 // This should have created a new browser window.
1622 Browser* new_browser = FindOneOtherBrowser(browser()); 1620 Browser* new_browser = FindOneOtherBrowser(browser());
1623 ASSERT_TRUE(new_browser); 1621 ASSERT_TRUE(new_browser);
1624 1622
1625 // Verify that the URL specified through policy is shown and no sync promo has 1623 // Verify that the URL specified through policy is shown and no sync promo has
1626 // been added. 1624 // been added.
1627 TabStripModel* tab_strip = new_browser->tab_strip_model(); 1625 TabStripModel* tab_strip = new_browser->tab_strip_model();
1628 ASSERT_EQ(1, tab_strip->count()); 1626 ASSERT_EQ(1, tab_strip->count());
1629 EXPECT_EQ("title1.html", 1627 EXPECT_EQ("title1.html",
1630 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); 1628 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName());
1631 } 1629 }
1632 #endif // defined(ENABLE_CONFIGURATION_POLICY) 1630 #endif // defined(ENABLE_CONFIGURATION_POLICY)
1633 1631
1634 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) || 1632 #endif // !defined(OS_LINUX) || !defined(GOOGLE_CHROME_BUILD) ||
1635 // defined(ENABLE_CONFIGURATION_POLICY) 1633 // defined(ENABLE_CONFIGURATION_POLICY)
1636 1634
1637 #endif // !defined(OS_CHROMEOS) 1635 #endif // !defined(OS_CHROMEOS)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698