OLD | NEW |
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 "build/build_config.h" | 7 #include "build/build_config.h" |
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 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 } | 591 } |
592 | 592 |
593 void TestingProfile::SetOriginalProfile(Profile* profile) { | 593 void TestingProfile::SetOriginalProfile(Profile* profile) { |
594 DCHECK(IsOffTheRecord()); | 594 DCHECK(IsOffTheRecord()); |
595 original_profile_ = profile; | 595 original_profile_ = profile; |
596 } | 596 } |
597 | 597 |
598 Profile* TestingProfile::GetOffTheRecordProfile() { | 598 Profile* TestingProfile::GetOffTheRecordProfile() { |
599 if (IsOffTheRecord()) | 599 if (IsOffTheRecord()) |
600 return this; | 600 return this; |
| 601 if (!incognito_profile_) { |
| 602 TestingProfile::Builder builder; |
| 603 builder.SetIncognito(); |
| 604 scoped_ptr<TestingProfile> incognito_test_profile(builder.Build()); |
| 605 incognito_test_profile->SetOriginalProfile(this); |
| 606 SetOffTheRecordProfile(incognito_test_profile.PassAs<Profile>()); |
| 607 } |
601 return incognito_profile_.get(); | 608 return incognito_profile_.get(); |
602 } | 609 } |
603 | 610 |
604 bool TestingProfile::HasOffTheRecordProfile() { | 611 bool TestingProfile::HasOffTheRecordProfile() { |
605 return incognito_profile_.get() != NULL; | 612 return incognito_profile_.get() != NULL; |
606 } | 613 } |
607 | 614 |
608 Profile* TestingProfile::GetOriginalProfile() { | 615 Profile* TestingProfile::GetOriginalProfile() { |
609 if (original_profile_) | 616 if (original_profile_) |
610 return original_profile_; | 617 return original_profile_; |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
946 path_, | 953 path_, |
947 delegate_, | 954 delegate_, |
948 extension_policy_, | 955 extension_policy_, |
949 pref_service_.Pass(), | 956 pref_service_.Pass(), |
950 incognito_, | 957 incognito_, |
951 guest_session_, | 958 guest_session_, |
952 managed_user_id_, | 959 managed_user_id_, |
953 policy_service_.Pass(), | 960 policy_service_.Pass(), |
954 testing_factories_)); | 961 testing_factories_)); |
955 } | 962 } |
OLD | NEW |