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

Side by Side Diff: chrome/browser/net/errorpage_browsertest.cc

Issue 2733393003: Split browsing data masks between content and embedder (Closed)
Patch Set: Extensions can't match extensions if there are no extensions. Created 3 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
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 <memory> 5 #include <memory>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/files/scoped_temp_dir.h" 11 #include "base/files/scoped_temp_dir.h"
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/path_service.h" 16 #include "base/path_service.h"
17 #include "base/strings/stringprintf.h" 17 #include "base/strings/stringprintf.h"
18 #include "base/strings/utf_string_conversions.h" 18 #include "base/strings/utf_string_conversions.h"
19 #include "base/synchronization/lock.h" 19 #include "base/synchronization/lock.h"
20 #include "base/threading/sequenced_worker_pool.h" 20 #include "base/threading/sequenced_worker_pool.h"
21 #include "base/values.h" 21 #include "base/values.h"
22 #include "build/build_config.h" 22 #include "build/build_config.h"
23 #include "chrome/browser/browsing_data/browsing_data_helper.h" 23 #include "chrome/browser/browsing_data/browsing_data_helper.h"
24 #include "chrome/browser/browsing_data/browsing_data_remover.h" 24 #include "chrome/browser/browsing_data/browsing_data_remover.h"
25 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h" 25 #include "chrome/browser/browsing_data/browsing_data_remover_factory.h"
26 #include "chrome/browser/browsing_data/chrome_browsing_data_remover_delegate.h"
26 #include "chrome/browser/net/net_error_diagnostics_dialog.h" 27 #include "chrome/browser/net/net_error_diagnostics_dialog.h"
27 #include "chrome/browser/net/url_request_mock_util.h" 28 #include "chrome/browser/net/url_request_mock_util.h"
28 #include "chrome/browser/profiles/profile.h" 29 #include "chrome/browser/profiles/profile.h"
29 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h" 30 #include "chrome/browser/search_engines/ui_thread_search_terms_data.h"
30 #include "chrome/browser/ui/browser.h" 31 #include "chrome/browser/ui/browser.h"
31 #include "chrome/browser/ui/browser_commands.h" 32 #include "chrome/browser/ui/browser_commands.h"
32 #include "chrome/browser/ui/tabs/tab_strip_model.h" 33 #include "chrome/browser/ui/tabs/tab_strip_model.h"
33 #include "chrome/common/chrome_paths.h" 34 #include "chrome/common/chrome_paths.h"
34 #include "chrome/common/chrome_switches.h" 35 #include "chrome/common/chrome_switches.h"
35 #include "chrome/common/pref_names.h" 36 #include "chrome/common/pref_names.h"
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 // that there is no cached copy. 1002 // that there is no cached copy.
1002 ui_test_utils::NavigateToURLWithPost(browser(), test_url); 1003 ui_test_utils::NavigateToURLWithPost(browser(), test_url);
1003 EXPECT_TRUE(ProbeStaleCopyValue(false)); 1004 EXPECT_TRUE(ProbeStaleCopyValue(false));
1004 EXPECT_FALSE(IsDisplayingText(browser(), GetShowSavedButtonLabel())); 1005 EXPECT_FALSE(IsDisplayingText(browser(), GetShowSavedButtonLabel()));
1005 EXPECT_EQ(0, link_doctor_interceptor()->num_requests()); 1006 EXPECT_EQ(0, link_doctor_interceptor()->num_requests());
1006 1007
1007 // Clear the cache and reload the same URL; confirm the error page is told 1008 // Clear the cache and reload the same URL; confirm the error page is told
1008 // that there is no cached copy. 1009 // that there is no cached copy.
1009 BrowsingDataRemover* remover = 1010 BrowsingDataRemover* remover =
1010 BrowsingDataRemoverFactory::GetForBrowserContext(browser()->profile()); 1011 BrowsingDataRemoverFactory::GetForBrowserContext(browser()->profile());
1011 remover->Remove(base::Time(), base::Time::Max(), 1012 remover->Remove(
1012 BrowsingDataRemover::REMOVE_CACHE, 1013 base::Time(), base::Time::Max(),
1013 BrowsingDataHelper::UNPROTECTED_WEB); 1014 ChromeBrowsingDataRemoverDelegate::DATA_TYPE_CACHE,
1015 ChromeBrowsingDataRemoverDelegate::ORIGIN_TYPE_UNPROTECTED_WEB);
1014 ui_test_utils::NavigateToURL(browser(), test_url); 1016 ui_test_utils::NavigateToURL(browser(), test_url);
1015 EXPECT_TRUE(ProbeStaleCopyValue(false)); 1017 EXPECT_TRUE(ProbeStaleCopyValue(false));
1016 EXPECT_FALSE(IsDisplayingText(browser(), GetShowSavedButtonLabel())); 1018 EXPECT_FALSE(IsDisplayingText(browser(), GetShowSavedButtonLabel()));
1017 EXPECT_EQ(0, link_doctor_interceptor()->num_requests()); 1019 EXPECT_EQ(0, link_doctor_interceptor()->num_requests());
1018 } 1020 }
1019 1021
1020 // Check that the easter egg is present and initialised and is not disabled. 1022 // Check that the easter egg is present and initialised and is not disabled.
1021 IN_PROC_BROWSER_TEST_F(ErrorPageTest, CheckEasterEggIsNotDisabled) { 1023 IN_PROC_BROWSER_TEST_F(ErrorPageTest, CheckEasterEggIsNotDisabled) {
1022 ui_test_utils::NavigateToURL(browser(), 1024 ui_test_utils::NavigateToURL(browser(),
1023 URLRequestFailedJob::GetMockHttpUrl(net::ERR_INTERNET_DISCONNECTED)); 1025 URLRequestFailedJob::GetMockHttpUrl(net::ERR_INTERNET_DISCONNECTED));
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 browser()->tab_strip_model()->GetActiveWebContents(), 1); 1276 browser()->tab_strip_model()->GetActiveWebContents(), 1);
1275 ASSERT_TRUE(ReloadStaleCopyFromCache()); 1277 ASSERT_TRUE(ReloadStaleCopyFromCache());
1276 same_tab_observer.Wait(); 1278 same_tab_observer.Wait();
1277 EXPECT_EQ(base::ASCIIToUTF16("Nocache Test Page"), 1279 EXPECT_EQ(base::ASCIIToUTF16("Nocache Test Page"),
1278 browser()->tab_strip_model()->GetActiveWebContents()->GetTitle()); 1280 browser()->tab_strip_model()->GetActiveWebContents()->GetTitle());
1279 1281
1280 // Clear the cache and reload the same URL; confirm the error page is told 1282 // Clear the cache and reload the same URL; confirm the error page is told
1281 // that there is no cached copy. 1283 // that there is no cached copy.
1282 BrowsingDataRemover* remover = 1284 BrowsingDataRemover* remover =
1283 BrowsingDataRemoverFactory::GetForBrowserContext(browser()->profile()); 1285 BrowsingDataRemoverFactory::GetForBrowserContext(browser()->profile());
1284 remover->Remove(base::Time(), base::Time::Max(), 1286 remover->Remove(
1285 BrowsingDataRemover::REMOVE_CACHE, 1287 base::Time(), base::Time::Max(),
1286 BrowsingDataHelper::UNPROTECTED_WEB); 1288 ChromeBrowsingDataRemoverDelegate::DATA_TYPE_CACHE,
1289 ChromeBrowsingDataRemoverDelegate::ORIGIN_TYPE_UNPROTECTED_WEB);
1287 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete( 1290 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(
1288 browser(), test_url, 2); 1291 browser(), test_url, 2);
1289 EXPECT_TRUE(ProbeStaleCopyValue(false)); 1292 EXPECT_TRUE(ProbeStaleCopyValue(false));
1290 EXPECT_FALSE(IsDisplayingText(browser(), GetShowSavedButtonLabel())); 1293 EXPECT_FALSE(IsDisplayingText(browser(), GetShowSavedButtonLabel()));
1291 } 1294 }
1292 1295
1293 class ErrorPageOfflineTest : public ErrorPageTest { 1296 class ErrorPageOfflineTest : public ErrorPageTest {
1294 protected: 1297 protected:
1295 1298
1296 void SetUpInProcessBrowserTestFixture() override { 1299 void SetUpInProcessBrowserTestFixture() override {
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
1529 Http09WeirdPortEnabled) { 1532 Http09WeirdPortEnabled) {
1530 const char kHttp09Response[] = "JumboShrimp"; 1533 const char kHttp09Response[] = "JumboShrimp";
1531 ASSERT_TRUE(embedded_test_server()->Start()); 1534 ASSERT_TRUE(embedded_test_server()->Start());
1532 ui_test_utils::NavigateToURL( 1535 ui_test_utils::NavigateToURL(
1533 browser(), embedded_test_server()->GetURL(std::string("/echo-raw?") + 1536 browser(), embedded_test_server()->GetURL(std::string("/echo-raw?") +
1534 kHttp09Response)); 1537 kHttp09Response));
1535 EXPECT_TRUE(IsDisplayingText(browser(), kHttp09Response)); 1538 EXPECT_TRUE(IsDisplayingText(browser(), kHttp09Response));
1536 } 1539 }
1537 1540
1538 } // namespace 1541 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698