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

Side by Side Diff: chrome/browser/translate/translate_service.cc

Issue 186063007: Move TranslateManager unit tests out of the browser_tests target. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: translatetests: comment Created 6 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
« no previous file with comments | « chrome/browser/translate/translate_service.h ('k') | chrome/chrome_tests_unit.gypi » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/translate/translate_service.h" 5 #include "chrome/browser/translate/translate_service.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/browser_process.h"
9 #include "chrome/common/chrome_switches.h" 9 #include "chrome/common/chrome_switches.h"
10 #include "components/translate/core/browser/translate_download_manager.h" 10 #include "components/translate/core/browser/translate_download_manager.h"
(...skipping 25 matching lines...) Expand all
36 g_browser_process->GetApplicationLocale()); 36 g_browser_process->GetApplicationLocale());
37 } 37 }
38 38
39 // static 39 // static
40 void TranslateService::Shutdown(bool cleanup_pending_fetcher) { 40 void TranslateService::Shutdown(bool cleanup_pending_fetcher) {
41 TranslateDownloadManager* download_manager = 41 TranslateDownloadManager* download_manager =
42 TranslateDownloadManager::GetInstance(); 42 TranslateDownloadManager::GetInstance();
43 if (cleanup_pending_fetcher) { 43 if (cleanup_pending_fetcher) {
44 download_manager->Shutdown(); 44 download_manager->Shutdown();
45 } else { 45 } else {
46 // This path is only used by tests. 46 // This path is only used by browser tests.
47 download_manager->set_request_context(NULL); 47 download_manager->set_request_context(NULL);
48 } 48 }
49 } 49 }
50 50
51 // static
52 void TranslateService::InitializeForTesting() {
53 if (!g_translate_service) {
54 TranslateService::Initialize();
55 } else {
56 TranslateDownloadManager::GetInstance()->ResetForTesting();
57 g_translate_service->OnResourceRequestsAllowed();
58 }
59 }
60
61 // static
62 void TranslateService::ShutdownForTesting() {
63 TranslateDownloadManager::GetInstance()->Shutdown();
64 }
65
51 void TranslateService::OnResourceRequestsAllowed() { 66 void TranslateService::OnResourceRequestsAllowed() {
52 TranslateLanguageList* language_list = 67 TranslateLanguageList* language_list =
53 TranslateDownloadManager::GetInstance()->language_list(); 68 TranslateDownloadManager::GetInstance()->language_list();
54 if (!language_list) { 69 if (!language_list) {
55 NOTREACHED(); 70 NOTREACHED();
56 return; 71 return;
57 } 72 }
58 73
59 language_list->SetResourceRequestsAllowed( 74 language_list->SetResourceRequestsAllowed(
60 resource_request_allowed_notifier_.ResourceRequestsAllowed()); 75 resource_request_allowed_notifier_.ResourceRequestsAllowed());
(...skipping 12 matching lines...) Expand all
73 // The bubble UX is not implemented on the non-Aura platforms. 88 // The bubble UX is not implemented on the non-Aura platforms.
74 return false; 89 return false;
75 #endif 90 #endif
76 } 91 }
77 92
78 // static 93 // static
79 void TranslateService::SetUseInfobar(bool value) { 94 void TranslateService::SetUseInfobar(bool value) {
80 Initialize(); 95 Initialize();
81 g_translate_service->use_infobar_ = value; 96 g_translate_service->use_infobar_ = value;
82 } 97 }
OLDNEW
« no previous file with comments | « chrome/browser/translate/translate_service.h ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698