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

Side by Side Diff: chrome/test/base/testing_profile.cc

Issue 2298283002: Site Settings Desktop: Support adding exceptions for incognito mode. (Closed)
Patch Set: Fix test Created 4 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
« no previous file with comments | « chrome/test/base/testing_profile.h ('k') | chrome/test/data/webui/settings/site_list_tests.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/test/base/testing_profile.h" 5 #include "chrome/test/base/testing_profile.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/base_paths.h" 9 #include "base/base_paths.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 return INCOGNITO_PROFILE; 681 return INCOGNITO_PROFILE;
682 return REGULAR_PROFILE; 682 return REGULAR_PROFILE;
683 } 683 }
684 684
685 bool TestingProfile::IsOffTheRecord() const { 685 bool TestingProfile::IsOffTheRecord() const {
686 return force_incognito_ || original_profile_; 686 return force_incognito_ || original_profile_;
687 } 687 }
688 688
689 void TestingProfile::SetOffTheRecordProfile(std::unique_ptr<Profile> profile) { 689 void TestingProfile::SetOffTheRecordProfile(std::unique_ptr<Profile> profile) {
690 DCHECK(!IsOffTheRecord()); 690 DCHECK(!IsOffTheRecord());
691 DCHECK_EQ(this, profile->GetOriginalProfile()); 691 if (profile)
692 DCHECK_EQ(this, profile->GetOriginalProfile());
692 incognito_profile_ = std::move(profile); 693 incognito_profile_ = std::move(profile);
693 } 694 }
694 695
695 Profile* TestingProfile::GetOffTheRecordProfile() { 696 Profile* TestingProfile::GetOffTheRecordProfile() {
696 if (IsOffTheRecord()) 697 if (IsOffTheRecord())
697 return this; 698 return this;
698 if (!incognito_profile_) 699 if (!incognito_profile_)
699 TestingProfile::Builder().BuildIncognito(this); 700 TestingProfile::Builder().BuildIncognito(this);
700 return incognito_profile_.get(); 701 return incognito_profile_.get();
701 } 702 }
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 return guest_view::GuestViewManager::FromBrowserContext(this); 861 return guest_view::GuestViewManager::FromBrowserContext(this);
861 #else 862 #else
862 return NULL; 863 return NULL;
863 #endif 864 #endif
864 } 865 }
865 866
866 content::PushMessagingService* TestingProfile::GetPushMessagingService() { 867 content::PushMessagingService* TestingProfile::GetPushMessagingService() {
867 return NULL; 868 return NULL;
868 } 869 }
869 870
870 bool TestingProfile::IsSameProfile(Profile *p) { 871 bool TestingProfile::IsSameProfile(Profile *profile) {
871 return this == p; 872 if (this == profile)
873 return true;
874 Profile* otr_profile = incognito_profile_.get();
875 return otr_profile && profile == otr_profile;
872 } 876 }
873 877
874 base::Time TestingProfile::GetStartTime() const { 878 base::Time TestingProfile::GetStartTime() const {
875 return start_time_; 879 return start_time_;
876 } 880 }
877 881
878 base::FilePath TestingProfile::last_selected_directory() { 882 base::FilePath TestingProfile::last_selected_directory() {
879 return last_selected_directory_; 883 return last_selected_directory_;
880 } 884 }
881 885
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 // Note: Owned by |original_profile|. 1073 // Note: Owned by |original_profile|.
1070 return new TestingProfile(path_, delegate_, 1074 return new TestingProfile(path_, delegate_,
1071 #if defined(ENABLE_EXTENSIONS) 1075 #if defined(ENABLE_EXTENSIONS)
1072 extension_policy_, 1076 extension_policy_,
1073 #endif 1077 #endif
1074 std::move(pref_service_), original_profile, 1078 std::move(pref_service_), original_profile,
1075 guest_session_, supervised_user_id_, 1079 guest_session_, supervised_user_id_,
1076 std::move(policy_service_), testing_factories_, 1080 std::move(policy_service_), testing_factories_,
1077 profile_name_); 1081 profile_name_);
1078 } 1082 }
OLDNEW
« no previous file with comments | « chrome/test/base/testing_profile.h ('k') | chrome/test/data/webui/settings/site_list_tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698