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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 #include "net/url_request/url_request.h" | 45 #include "net/url_request/url_request.h" |
46 #include "net/url_request/url_request_filter.h" | 46 #include "net/url_request/url_request_filter.h" |
47 #include "net/url_request/url_request_test_job.h" | 47 #include "net/url_request/url_request_test_job.h" |
48 | 48 |
49 #if defined(OS_MACOSX) | 49 #if defined(OS_MACOSX) |
50 #include "base/mac/scoped_nsautorelease_pool.h" | 50 #include "base/mac/scoped_nsautorelease_pool.h" |
51 #endif | 51 #endif |
52 | 52 |
53 namespace { | 53 namespace { |
54 | 54 |
55 Browser* FindOneOtherBrowserForProfile(Profile* profile, | |
56 Browser* not_this_browser) { | |
57 for (chrome::BrowserIterator it; !it.done(); it.Next()) { | |
58 if (*it != not_this_browser && it->profile() == profile) | |
59 return *it; | |
60 } | |
61 return NULL; | |
62 } | |
63 | |
64 // We need to serve the test files so that PRE_Test and Test can access the same | 55 // We need to serve the test files so that PRE_Test and Test can access the same |
65 // page using the same URL. In addition, perceived security origin of the page | 56 // page using the same URL. In addition, perceived security origin of the page |
66 // needs to stay the same, so e.g., redirecting the URL requests doesn't | 57 // needs to stay the same, so e.g., redirecting the URL requests doesn't |
67 // work. (If we used a test server, the PRE_Test and Test would have separate | 58 // work. (If we used a test server, the PRE_Test and Test would have separate |
68 // instances running on separate ports.) | 59 // instances running on separate ports.) |
69 | 60 |
70 base::LazyInstance<std::map<std::string, std::string> > g_file_contents = | 61 base::LazyInstance<std::map<std::string, std::string> > g_file_contents = |
71 LAZY_INSTANCE_INITIALIZER; | 62 LAZY_INSTANCE_INITIALIZER; |
72 | 63 |
73 net::URLRequestJob* URLRequestFaker( | 64 net::URLRequestJob* URLRequestFaker( |
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 CookieSettings::Factory::GetForProfile(new_browser->profile())-> | 790 CookieSettings::Factory::GetForProfile(new_browser->profile())-> |
800 SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); | 791 SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); |
801 // ... even if background mode is active. | 792 // ... even if background mode is active. |
802 EnableBackgroundMode(); | 793 EnableBackgroundMode(); |
803 new_browser = QuitBrowserAndRestore(new_browser, true); | 794 new_browser = QuitBrowserAndRestore(new_browser, true); |
804 StoreDataWithPage(new_browser, "cookies.html"); | 795 StoreDataWithPage(new_browser, "cookies.html"); |
805 DisableBackgroundMode(); | 796 DisableBackgroundMode(); |
806 new_browser = QuitBrowserAndRestore(new_browser, true); | 797 new_browser = QuitBrowserAndRestore(new_browser, true); |
807 StoreDataWithPage(new_browser, "cookies.html"); | 798 StoreDataWithPage(new_browser, "cookies.html"); |
808 } | 799 } |
OLD | NEW |