| 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/file_path.h" | 5 #include "base/file_path.h" |
| 6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 7 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 8 #include "chrome/browser/browsing_data/browsing_data_remover.h" | 8 #include "chrome/browser/browsing_data/browsing_data_remover.h" |
| 9 #include "chrome/browser/prefs/pref_service.h" | 9 #include "chrome/browser/prefs/pref_service.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "content/public/common/content_paths.h" | 21 #include "content/public/common/content_paths.h" |
| 22 #include "content/public/test/browser_test_utils.h" | 22 #include "content/public/test/browser_test_utils.h" |
| 23 #include "content/public/test/download_test_observer.h" | 23 #include "content/public/test/download_test_observer.h" |
| 24 #include "content/test/net/url_request_mock_http_job.h" | 24 #include "content/test/net/url_request_mock_http_job.h" |
| 25 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 26 | 26 |
| 27 using content::BrowserThread; | 27 using content::BrowserThread; |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 void SetUrlRequestMock(const FilePath& path) { | 30 void SetUrlRequestMock(const FilePath& path) { |
| 31 URLRequestMockHTTPJob::AddUrlHandler(path); | 31 content::URLRequestMockHTTPJob::AddUrlHandler(path); |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 | 34 |
| 35 class BrowsingDataRemoverBrowserTest : public InProcessBrowserTest { | 35 class BrowsingDataRemoverBrowserTest : public InProcessBrowserTest { |
| 36 public: | 36 public: |
| 37 BrowsingDataRemoverBrowserTest() {} | 37 BrowsingDataRemoverBrowserTest() {} |
| 38 | 38 |
| 39 virtual void SetUpOnMainThread() OVERRIDE { | 39 virtual void SetUpOnMainThread() OVERRIDE { |
| 40 FilePath path; | 40 FilePath path; |
| 41 PathService::Get(content::DIR_TEST_DATA, &path); | 41 PathService::Get(content::DIR_TEST_DATA, &path); |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 90 |
| 91 RemoveAndWait(BrowsingDataRemover::REMOVE_DOWNLOADS); | 91 RemoveAndWait(BrowsingDataRemover::REMOVE_DOWNLOADS); |
| 92 | 92 |
| 93 downloads.clear(); | 93 downloads.clear(); |
| 94 download_manager->GetAllDownloads(&downloads); | 94 download_manager->GetAllDownloads(&downloads); |
| 95 EXPECT_TRUE(downloads.empty()); | 95 EXPECT_TRUE(downloads.empty()); |
| 96 } | 96 } |
| 97 | 97 |
| 98 // Verify can modify database after deleting it. | 98 // Verify can modify database after deleting it. |
| 99 IN_PROC_BROWSER_TEST_F(BrowsingDataRemoverBrowserTest, Database) { | 99 IN_PROC_BROWSER_TEST_F(BrowsingDataRemoverBrowserTest, Database) { |
| 100 GURL url(URLRequestMockHTTPJob::GetMockUrl( | 100 GURL url(content::URLRequestMockHTTPJob::GetMockUrl( |
| 101 FilePath().AppendASCII("simple_database.html"))); | 101 FilePath().AppendASCII("simple_database.html"))); |
| 102 ui_test_utils::NavigateToURL(browser(), url); | 102 ui_test_utils::NavigateToURL(browser(), url); |
| 103 | 103 |
| 104 RunScriptAndCheckResult(L"createTable()", "done"); | 104 RunScriptAndCheckResult(L"createTable()", "done"); |
| 105 RunScriptAndCheckResult(L"insertRecord('text')", "done"); | 105 RunScriptAndCheckResult(L"insertRecord('text')", "done"); |
| 106 RunScriptAndCheckResult(L"getRecords()", "text"); | 106 RunScriptAndCheckResult(L"getRecords()", "text"); |
| 107 | 107 |
| 108 RemoveAndWait(BrowsingDataRemover::REMOVE_SITE_DATA); | 108 RemoveAndWait(BrowsingDataRemover::REMOVE_SITE_DATA); |
| 109 | 109 |
| 110 ui_test_utils::NavigateToURL(browser(), url); | 110 ui_test_utils::NavigateToURL(browser(), url); |
| 111 RunScriptAndCheckResult(L"createTable()", "done"); | 111 RunScriptAndCheckResult(L"createTable()", "done"); |
| 112 RunScriptAndCheckResult(L"insertRecord('text2')", "done"); | 112 RunScriptAndCheckResult(L"insertRecord('text2')", "done"); |
| 113 RunScriptAndCheckResult(L"getRecords()", "text2"); | 113 RunScriptAndCheckResult(L"getRecords()", "text2"); |
| 114 } | 114 } |
| OLD | NEW |