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

Side by Side Diff: chrome/browser/prefs/session_startup_pref_unittest.cc

Issue 9583025: Revert 124583 (See crbug.com/114259) Original info for r124583 is: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/prefs/session_startup_pref.h" 5 #include "chrome/browser/prefs/session_startup_pref.h"
6 #include "chrome/common/pref_names.h" 6 #include "chrome/common/pref_names.h"
7 #include "chrome/test/base/testing_pref_service.h" 7 #include "chrome/test/base/testing_pref_service.h"
8 #include "testing/gmock/include/gmock/gmock.h" 8 #include "testing/gmock/include/gmock/gmock.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 // Unit tests for SessionStartupPref. 11 // Unit tests for SessionStartupPref.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 EXPECT_EQ(3u, result.urls.size()); 49 EXPECT_EQ(3u, result.urls.size());
50 50
51 SessionStartupPref override_test = 51 SessionStartupPref override_test =
52 SessionStartupPref(SessionStartupPref::URLS); 52 SessionStartupPref(SessionStartupPref::URLS);
53 override_test.urls.push_back(GURL("dev.chromium.org")); 53 override_test.urls.push_back(GURL("dev.chromium.org"));
54 SessionStartupPref::SetStartupPref(pref_service_.get(), override_test); 54 SessionStartupPref::SetStartupPref(pref_service_.get(), override_test);
55 55
56 result = SessionStartupPref::GetStartupPref(pref_service_.get()); 56 result = SessionStartupPref::GetStartupPref(pref_service_.get());
57 EXPECT_EQ(3u, result.urls.size()); 57 EXPECT_EQ(3u, result.urls.size());
58 } 58 }
59
60 TEST_F(SessionStartupPrefTest, HomePageMigration) {
61 pref_service_->RegisterStringPref(prefs::kHomePage, "http://google.com/");
62
63 // By design, it's impossible to set the 'restore on startup' pref to 0
64 // ("open the homepage") using SessionStartupPref::SetStartupPref(), so set it
65 // using the pref service directly.
66 pref_service_->SetInteger(prefs::kRestoreOnStartup, /*kPrefValueHomePage*/ 0);
67 pref_service_->SetString(prefs::kHomePage, "http://chromium.org/");
68
69 SessionStartupPref pref = SessionStartupPref::GetStartupPref(
70 pref_service_.get());
71 EXPECT_EQ(SessionStartupPref::URLS, pref.type);
72 EXPECT_EQ(1U, pref.urls.size());
73 EXPECT_EQ(GURL("http://chromium.org/"), pref.urls[0]);
74 }
OLDNEW
« no previous file with comments | « chrome/browser/prefs/session_startup_pref.cc ('k') | chrome/browser/resources/options2/browser_options.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698