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

Unified Diff: chrome/browser/translate/translate_manager_render_view_host_unittest.cc

Issue 2839433002: [translate] Fix shutdown race for translate ranker model loader. (Closed)
Patch Set: fdoray part deux Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | components/translate/core/browser/ranker_model_loader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/translate/translate_manager_render_view_host_unittest.cc
diff --git a/chrome/browser/translate/translate_manager_render_view_host_unittest.cc b/chrome/browser/translate/translate_manager_render_view_host_unittest.cc
index 0e0d2a86c446c5e241a978c3104a2159173476bd..88b1503a9bdce6fcae152961c002ba1d73d06a55 100644
--- a/chrome/browser/translate/translate_manager_render_view_host_unittest.cc
+++ b/chrome/browser/translate/translate_manager_render_view_host_unittest.cc
@@ -60,6 +60,7 @@
#include "net/url_request/test_url_fetcher_factory.h"
#include "net/url_request/url_fetcher_delegate.h"
#include "net/url_request/url_request_status.h"
+#include "net/url_request/url_request_test_util.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "third_party/WebKit/public/web/WebContextMenuData.h"
#include "url/gurl.h"
@@ -454,17 +455,22 @@ class TranslateManagerRenderViewHostTest
protected:
virtual void SetUp() {
- TranslateService::InitializeForTesting();
+ // Setup the test environment, including the threads and message loops. This
+ // must be done before base::ThreadTaskRunnerHandle::Get() is called when
+ // setting up the net::TestURLRequestContextGetter below.
+ ChromeRenderViewHostTestHarness::SetUp();
- // Clears the translate script so it is fetched everytime and sets the
+ // Clears the translate script so it is fetched every time and sets the
// expiration delay to a large value by default (in case it was zeroed in a
// previous test).
+ TranslateService::InitializeForTesting();
translate::TranslateDownloadManager* download_manager =
translate::TranslateDownloadManager::GetInstance();
download_manager->ClearTranslateScriptForTesting();
download_manager->SetTranslateScriptExpirationDelay(60 * 60 * 1000);
+ download_manager->set_request_context(new net::TestURLRequestContextGetter(
+ base::ThreadTaskRunnerHandle::Get()));
- ChromeRenderViewHostTestHarness::SetUp();
InfoBarService::CreateForWebContents(web_contents());
ChromeTranslateClient::CreateForWebContents(web_contents());
ChromeTranslateClient::FromWebContents(web_contents())
« no previous file with comments | « no previous file | components/translate/core/browser/ranker_model_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698