OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/profile_resetter/profile_resetter.h" | 5 #include "chrome/browser/profile_resetter/profile_resetter.h" |
6 | 6 |
7 #include "base/json/json_string_value_serializer.h" | 7 #include "base/json/json_string_value_serializer.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 724 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 scoped_ptr<content::WebContents> contents4(CreateWebContents()); | 735 scoped_ptr<content::WebContents> contents4(CreateWebContents()); |
736 TabStripModel* tab_strip_model = browser()->tab_strip_model(); | 736 TabStripModel* tab_strip_model = browser()->tab_strip_model(); |
737 | 737 |
738 tab_strip_model->AppendWebContents(contents4.get(), true); | 738 tab_strip_model->AppendWebContents(contents4.get(), true); |
739 tab_strip_model->AppendWebContents(contents3.get(), true); | 739 tab_strip_model->AppendWebContents(contents3.get(), true); |
740 tab_strip_model->AppendWebContents(contents2.get(), true); | 740 tab_strip_model->AppendWebContents(contents2.get(), true); |
741 tab_strip_model->SetTabPinned(2, true); | 741 tab_strip_model->SetTabPinned(2, true); |
742 tab_strip_model->AppendWebContents(contents1.get(), true); | 742 tab_strip_model->AppendWebContents(contents1.get(), true); |
743 tab_strip_model->SetTabPinned(3, true); | 743 tab_strip_model->SetTabPinned(3, true); |
744 | 744 |
745 EXPECT_EQ(contents2, tab_strip_model->GetWebContentsAt(0)); | 745 EXPECT_EQ(contents2.get(), tab_strip_model->GetWebContentsAt(0)); |
746 EXPECT_EQ(contents1, tab_strip_model->GetWebContentsAt(1)); | 746 EXPECT_EQ(contents1.get(), tab_strip_model->GetWebContentsAt(1)); |
747 EXPECT_EQ(contents4, tab_strip_model->GetWebContentsAt(2)); | 747 EXPECT_EQ(contents4.get(), tab_strip_model->GetWebContentsAt(2)); |
748 EXPECT_EQ(contents3, tab_strip_model->GetWebContentsAt(3)); | 748 EXPECT_EQ(contents3.get(), tab_strip_model->GetWebContentsAt(3)); |
749 EXPECT_EQ(2, tab_strip_model->IndexOfFirstNonPinnedTab()); | 749 EXPECT_EQ(2, tab_strip_model->IndexOfFirstNonPinnedTab()); |
750 | 750 |
751 ResetAndWait(ProfileResetter::PINNED_TABS); | 751 ResetAndWait(ProfileResetter::PINNED_TABS); |
752 | 752 |
753 EXPECT_EQ(contents2, tab_strip_model->GetWebContentsAt(0)); | 753 EXPECT_EQ(contents2.get(), tab_strip_model->GetWebContentsAt(0)); |
754 EXPECT_EQ(contents1, tab_strip_model->GetWebContentsAt(1)); | 754 EXPECT_EQ(contents1.get(), tab_strip_model->GetWebContentsAt(1)); |
755 EXPECT_EQ(contents4, tab_strip_model->GetWebContentsAt(2)); | 755 EXPECT_EQ(contents4.get(), tab_strip_model->GetWebContentsAt(2)); |
756 EXPECT_EQ(contents3, tab_strip_model->GetWebContentsAt(3)); | 756 EXPECT_EQ(contents3.get(), tab_strip_model->GetWebContentsAt(3)); |
757 EXPECT_EQ(0, tab_strip_model->IndexOfFirstNonPinnedTab()); | 757 EXPECT_EQ(0, tab_strip_model->IndexOfFirstNonPinnedTab()); |
758 } | 758 } |
759 | 759 |
760 TEST_F(ProfileResetterTest, ResetShortcuts) { | 760 TEST_F(ProfileResetterTest, ResetShortcuts) { |
761 ShortcutHandler shortcut; | 761 ShortcutHandler shortcut; |
762 ShortcutCommand command_line = shortcut.CreateWithArguments( | 762 ShortcutCommand command_line = shortcut.CreateWithArguments( |
763 base::ASCIIToUTF16("chrome.lnk"), | 763 base::ASCIIToUTF16("chrome.lnk"), |
764 base::ASCIIToUTF16("--profile-directory=Default foo.com")); | 764 base::ASCIIToUTF16("--profile-directory=Default foo.com")); |
765 shortcut.CheckShortcutHasArguments(base::ASCIIToUTF16( | 765 shortcut.CheckShortcutHasArguments(base::ASCIIToUTF16( |
766 "--profile-directory=Default foo.com")); | 766 "--profile-directory=Default foo.com")); |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 new ResettableSettingsSnapshot(profile())); | 1069 new ResettableSettingsSnapshot(profile())); |
1070 deleted_snapshot->RequestShortcuts(base::Bind(&FeedbackCapture::Fail, | 1070 deleted_snapshot->RequestShortcuts(base::Bind(&FeedbackCapture::Fail, |
1071 base::Unretained(&capture))); | 1071 base::Unretained(&capture))); |
1072 deleted_snapshot.reset(); | 1072 deleted_snapshot.reset(); |
1073 // Running remaining tasks shouldn't trigger the callback to be called as | 1073 // Running remaining tasks shouldn't trigger the callback to be called as |
1074 // |deleted_snapshot| was deleted before it could run. | 1074 // |deleted_snapshot| was deleted before it could run. |
1075 base::MessageLoop::current()->RunUntilIdle(); | 1075 base::MessageLoop::current()->RunUntilIdle(); |
1076 } | 1076 } |
1077 | 1077 |
1078 } // namespace | 1078 } // namespace |
OLD | NEW |