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

Side by Side Diff: chrome/browser/browsing_data/browsing_data_remover_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: rebased 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 (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/files/file_path.h" 5 #include "base/files/file_path.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/browsing_data/browsing_data_helper.h" 8 #include "chrome/browser/browsing_data/browsing_data_helper.h"
9 #include "chrome/browser/browsing_data/browsing_data_remover.h" 9 #include "chrome/browser/browsing_data/browsing_data_remover.h"
10 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h" 10 #include "chrome/browser/browsing_data/browsing_data_remover_test_util.h"
11 #include "chrome/browser/chrome_notification_types.h" 11 #include "chrome/browser/chrome_notification_types.h"
12 #include "chrome/browser/profiles/profile.h" 12 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
14 #include "chrome/browser/ui/tabs/tab_strip_model.h" 14 #include "chrome/browser/ui/tabs/tab_strip_model.h"
15 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
16 #include "chrome/test/base/in_process_browser_test.h" 16 #include "chrome/test/base/in_process_browser_test.h"
17 #include "chrome/test/base/ui_test_utils.h" 17 #include "chrome/test/base/ui_test_utils.h"
18 #include "content/public/browser/browser_context.h" 18 #include "content/public/browser/browser_context.h"
19 #include "content/public/browser/browser_thread.h" 19 #include "content/public/browser/browser_thread.h"
20 #include "content/public/browser/download_manager.h" 20 #include "content/public/browser/download_manager.h"
21 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
22 #include "content/public/common/content_paths.h" 22 #include "content/public/common/content_paths.h"
23 #include "content/public/test/browser_test_utils.h" 23 #include "content/public/test/browser_test_utils.h"
24 #include "content/public/test/download_test_observer.h" 24 #include "content/public/test/download_test_observer.h"
25 #include "content/test/net/url_request_mock_http_job.h" 25 #include "net/test/url_request/url_request_mock_http_job.h"
26 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
27 27
28 using content::BrowserThread; 28 using content::BrowserThread;
29 29
30 namespace { 30 namespace {
31 void SetUrlRequestMock(const base::FilePath& path) { 31 void SetUrlRequestMock(const base::FilePath& path) {
32 content::URLRequestMockHTTPJob::AddUrlHandler(path); 32 net::URLRequestMockHTTPJob::AddUrlHandler(path,
33 BrowserThread::GetBlockingPool());
33 } 34 }
34 } 35 }
35 36
36 class BrowsingDataRemoverBrowserTest : public InProcessBrowserTest { 37 class BrowsingDataRemoverBrowserTest : public InProcessBrowserTest {
37 public: 38 public:
38 BrowsingDataRemoverBrowserTest() {} 39 BrowsingDataRemoverBrowserTest() {}
39 40
40 virtual void SetUpOnMainThread() OVERRIDE { 41 virtual void SetUpOnMainThread() OVERRIDE {
41 base::FilePath path; 42 base::FilePath path;
42 PathService::Get(content::DIR_TEST_DATA, &path); 43 PathService::Get(content::DIR_TEST_DATA, &path);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 prefs->SetBoolean(prefs::kAllowDeletingBrowserHistory, false); 110 prefs->SetBoolean(prefs::kAllowDeletingBrowserHistory, false);
110 111
111 DownloadAnItem(); 112 DownloadAnItem();
112 RemoveAndWait(BrowsingDataRemover::REMOVE_DOWNLOADS); 113 RemoveAndWait(BrowsingDataRemover::REMOVE_DOWNLOADS);
113 VerifyDownloadCount(1u); 114 VerifyDownloadCount(1u);
114 } 115 }
115 #endif 116 #endif
116 117
117 // Verify can modify database after deleting it. 118 // Verify can modify database after deleting it.
118 IN_PROC_BROWSER_TEST_F(BrowsingDataRemoverBrowserTest, Database) { 119 IN_PROC_BROWSER_TEST_F(BrowsingDataRemoverBrowserTest, Database) {
119 GURL url(content::URLRequestMockHTTPJob::GetMockUrl( 120 GURL url(net::URLRequestMockHTTPJob::GetMockUrl(
120 base::FilePath().AppendASCII("simple_database.html"))); 121 base::FilePath().AppendASCII("simple_database.html")));
121 ui_test_utils::NavigateToURL(browser(), url); 122 ui_test_utils::NavigateToURL(browser(), url);
122 123
123 RunScriptAndCheckResult("createTable()", "done"); 124 RunScriptAndCheckResult("createTable()", "done");
124 RunScriptAndCheckResult("insertRecord('text')", "done"); 125 RunScriptAndCheckResult("insertRecord('text')", "done");
125 RunScriptAndCheckResult("getRecords()", "text"); 126 RunScriptAndCheckResult("getRecords()", "text");
126 127
127 RemoveAndWait(BrowsingDataRemover::REMOVE_SITE_DATA); 128 RemoveAndWait(BrowsingDataRemover::REMOVE_SITE_DATA);
128 129
129 ui_test_utils::NavigateToURL(browser(), url); 130 ui_test_utils::NavigateToURL(browser(), url);
130 RunScriptAndCheckResult("createTable()", "done"); 131 RunScriptAndCheckResult("createTable()", "done");
131 RunScriptAndCheckResult("insertRecord('text2')", "done"); 132 RunScriptAndCheckResult("insertRecord('text2')", "done");
132 RunScriptAndCheckResult("getRecords()", "text2"); 133 RunScriptAndCheckResult("getRecords()", "text2");
133 } 134 }
134 135
135 // Profile::ClearNetworkingHistorySince should be exercised here too see whether 136 // Profile::ClearNetworkingHistorySince should be exercised here too see whether
136 // the call gets delegated through ProfileIO[Impl]Data properly, which is hard 137 // the call gets delegated through ProfileIO[Impl]Data properly, which is hard
137 // to write unit-tests for. Currently this is done by both of the above tests. 138 // to write unit-tests for. Currently this is done by both of the above tests.
138 // Add standalone test if this changes. 139 // Add standalone test if this changes.
OLDNEW
« no previous file with comments | « chrome/browser/browser_encoding_browsertest.cc ('k') | chrome/browser/captive_portal/captive_portal_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698