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

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

Issue 2030013003: Remove ListValue::Append(new {Fundamental,String}Value(...)) pattern in //chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1530 matching lines...) Expand 10 before | Expand all | Expand 10 after
1541 // Set the following user policies: 1541 // Set the following user policies:
1542 // * RestoreOnStartup = RestoreOnStartupIsURLs 1542 // * RestoreOnStartup = RestoreOnStartupIsURLs
1543 // * RestoreOnStartupURLs = [ "/title1.html" ] 1543 // * RestoreOnStartupURLs = [ "/title1.html" ]
1544 policy_map_.Set( 1544 policy_map_.Set(
1545 policy::key::kRestoreOnStartup, policy::POLICY_LEVEL_MANDATORY, 1545 policy::key::kRestoreOnStartup, policy::POLICY_LEVEL_MANDATORY,
1546 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, 1546 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD,
1547 base::WrapUnique( 1547 base::WrapUnique(
1548 new base::FundamentalValue(SessionStartupPref::kPrefValueURLs)), 1548 new base::FundamentalValue(SessionStartupPref::kPrefValueURLs)),
1549 nullptr); 1549 nullptr);
1550 base::ListValue startup_urls; 1550 base::ListValue startup_urls;
1551 startup_urls.Append(new base::StringValue( 1551 startup_urls.AppendString(
1552 embedded_test_server()->GetURL("/title1.html").spec())); 1552 embedded_test_server()->GetURL("/title1.html").spec());
1553 policy_map_.Set(policy::key::kRestoreOnStartupURLs, 1553 policy_map_.Set(policy::key::kRestoreOnStartupURLs,
1554 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, 1554 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER,
1555 policy::POLICY_SOURCE_CLOUD, startup_urls.CreateDeepCopy(), 1555 policy::POLICY_SOURCE_CLOUD, startup_urls.CreateDeepCopy(),
1556 nullptr); 1556 nullptr);
1557 provider_.UpdateChromePolicy(policy_map_); 1557 provider_.UpdateChromePolicy(policy_map_);
1558 base::RunLoop().RunUntilIdle(); 1558 base::RunLoop().RunUntilIdle();
1559 1559
1560 // Do a process-startup browser launch. 1560 // Do a process-startup browser launch.
1561 base::CommandLine dummy(base::CommandLine::NO_PROGRAM); 1561 base::CommandLine dummy(base::CommandLine::NO_PROGRAM);
1562 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator, 1562 StartupBrowserCreatorImpl launch(base::FilePath(), dummy, &browser_creator,
1563 chrome::startup::IS_FIRST_RUN); 1563 chrome::startup::IS_FIRST_RUN);
1564 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true)); 1564 ASSERT_TRUE(launch.Launch(browser()->profile(), std::vector<GURL>(), true));
1565 1565
1566 // This should have created a new browser window. 1566 // This should have created a new browser window.
1567 Browser* new_browser = FindOneOtherBrowser(browser()); 1567 Browser* new_browser = FindOneOtherBrowser(browser());
1568 ASSERT_TRUE(new_browser); 1568 ASSERT_TRUE(new_browser);
1569 1569
1570 // Verify that the URL specified through policy is shown and no sync promo has 1570 // Verify that the URL specified through policy is shown and no sync promo has
1571 // been added. 1571 // been added.
1572 TabStripModel* tab_strip = new_browser->tab_strip_model(); 1572 TabStripModel* tab_strip = new_browser->tab_strip_model();
1573 ASSERT_EQ(1, tab_strip->count()); 1573 ASSERT_EQ(1, tab_strip->count());
1574 EXPECT_EQ("title1.html", 1574 EXPECT_EQ("title1.html",
1575 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName()); 1575 tab_strip->GetWebContentsAt(0)->GetURL().ExtractFileName());
1576 } 1576 }
1577 1577
1578 #endif // !defined(OS_CHROMEOS) 1578 #endif // !defined(OS_CHROMEOS)
OLDNEW
« no previous file with comments | « chrome/browser/tracing/chrome_tracing_delegate.cc ('k') | chrome/browser/ui/webui/invalidations_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698