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

Side by Side Diff: chrome/browser/plugins/npapi_infobar_browsertest.cc

Issue 541743002: Move url_request_mock_http_job to net/test/url_request/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 6 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
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/memory/ref_counted.h"
8 #include "base/metrics/field_trial.h" 9 #include "base/metrics/field_trial.h"
9 #include "base/path_service.h" 10 #include "base/path_service.h"
10 #include "chrome/browser/infobars/infobar_service.h" 11 #include "chrome/browser/infobars/infobar_service.h"
11 #include "chrome/browser/net/url_request_mock_util.h" 12 #include "chrome/browser/net/url_request_mock_util.h"
12 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" 14 #include "chrome/browser/ui/tabs/tab_strip_model.h"
14 #include "chrome/common/chrome_switches.h" 15 #include "chrome/common/chrome_switches.h"
15 #include "chrome/common/render_messages.h" 16 #include "chrome/common/render_messages.h"
16 #include "chrome/test/base/in_process_browser_test.h" 17 #include "chrome/test/base/in_process_browser_test.h"
17 #include "chrome/test/base/ui_test_utils.h" 18 #include "chrome/test/base/ui_test_utils.h"
18 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
19 #include "content/public/common/content_paths.h" 20 #include "content/public/common/content_paths.h"
20 #include "content/public/common/content_switches.h" 21 #include "content/public/common/content_switches.h"
21 #include "content/public/test/browser_test_utils.h" 22 #include "content/public/test/browser_test_utils.h"
22 #include "content/public/test/test_utils.h" 23 #include "content/public/test/test_utils.h"
23 #include "content/test/net/url_request_mock_http_job.h" 24 #include "net/test/url_request/url_request_mock_http_job.h"
24 #include "url/gurl.h" 25 #include "url/gurl.h"
25 26
26 using content::BrowserThread; 27 using content::BrowserThread;
27 using content::URLRequestMockHTTPJob; 28 using net::URLRequestMockHTTPJob;
28 29
29 30
30 namespace { 31 namespace {
31 32
32 // Tests that the NPAPI unauthorized plugin infobar is: 33 // Tests that the NPAPI unauthorized plugin infobar is:
33 // (1) Shown when the Finch trial is set to "Enabled" 34 // (1) Shown when the Finch trial is set to "Enabled"
34 // (2) Not shown when the Finch trial is set to "Disabled" 35 // (2) Not shown when the Finch trial is set to "Disabled"
35 // TODO(cthomp): Remove/simplify when Finch trial is completed crbug.com/381944 36 // TODO(cthomp): Remove/simplify when Finch trial is completed crbug.com/381944
36 class UnauthorizedPluginInfoBarBrowserTest : public InProcessBrowserTest { 37 class UnauthorizedPluginInfoBarBrowserTest : public InProcessBrowserTest {
37 protected: 38 protected:
38 UnauthorizedPluginInfoBarBrowserTest() {} 39 UnauthorizedPluginInfoBarBrowserTest() {}
39 40
40 // Makes URLRequestMockHTTPJobs serve data from content::DIR_TEST_DATA 41 // Makes URLRequestMockHTTPJobs serve data from content::DIR_TEST_DATA
41 // instead of chrome::DIR_TEST_DATA. 42 // instead of chrome::DIR_TEST_DATA.
42 void ServeContentTestData() { 43 void ServeContentTestData() {
43 base::FilePath root_http; 44 base::FilePath root_http;
44 PathService::Get(content::DIR_TEST_DATA, &root_http); 45 PathService::Get(content::DIR_TEST_DATA, &root_http);
45 scoped_refptr<content::MessageLoopRunner> runner = 46 scoped_refptr<content::MessageLoopRunner> runner =
46 new content::MessageLoopRunner; 47 new content::MessageLoopRunner;
47 BrowserThread::PostTaskAndReply( 48 BrowserThread::PostTaskAndReply(
48 BrowserThread::IO, FROM_HERE, 49 BrowserThread::IO, FROM_HERE,
49 base::Bind(URLRequestMockHTTPJob::AddUrlHandler, root_http), 50 base::Bind(URLRequestMockHTTPJob::AddUrlHandler,
51 root_http,
52 make_scoped_refptr(
53 BrowserThread::GetBlockingPool())),
50 runner->QuitClosure()); 54 runner->QuitClosure());
51 runner->Run(); 55 runner->Run();
52 } 56 }
53 57
54 public: 58 public:
55 // Verifies that the test page exists (only present with src-internal) 59 // Verifies that the test page exists (only present with src-internal)
56 bool TestPageExists() { 60 bool TestPageExists() {
57 return base::PathExists(ui_test_utils::GetTestFilePath( 61 return base::PathExists(ui_test_utils::GetTestFilePath(
58 base::FilePath(FILE_PATH_LITERAL("plugin")), 62 base::FilePath(FILE_PATH_LITERAL("plugin")),
59 base::FilePath(FILE_PATH_LITERAL("quicktime.html")))); 63 base::FilePath(FILE_PATH_LITERAL("quicktime.html"))));
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 return; 107 return;
104 } 108 }
105 base::FieldTrialList::CreateTrialsFromString( 109 base::FieldTrialList::CreateTrialsFromString(
106 "UnauthorizedPluginInfoBar/Disabled/", 110 "UnauthorizedPluginInfoBar/Disabled/",
107 base::FieldTrialList::ACTIVATE_TRIALS, 111 base::FieldTrialList::ACTIVATE_TRIALS,
108 std::set<std::string>()); 112 std::set<std::string>());
109 InfoBarCountTest(0u, browser()); 113 InfoBarCountTest(0u, browser());
110 } 114 }
111 115
112 } // namespace 116 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698