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

Unified Diff: content/browser/appcache/appcache_browsertest.cc

Issue 2991443002: The Appcache subresource URL factory needs to inform the URLLoaderClient if there is a failure. (Closed)
Patch Set: Add browser test for verifying that navigating to a TLD within the same host which had an AppCache … Created 3 years, 5 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 | content/browser/appcache/appcache_subresource_url_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/appcache/appcache_browsertest.cc
diff --git a/content/browser/appcache/appcache_browsertest.cc b/content/browser/appcache/appcache_browsertest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a2504262f6f013591c4c175a04bb7c120fa75b86
--- /dev/null
+++ b/content/browser/appcache/appcache_browsertest.cc
@@ -0,0 +1,69 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include <stdint.h>
+
+#include "base/command_line.h"
+#include "content/public/common/content_features.h"
+#include "content/public/test/browser_test_utils.h"
+#include "content/public/test/content_browser_test.h"
+#include "content/public/test/content_browser_test_utils.h"
+#include "content/public/test/test_navigation_observer.h"
+#include "content/public/test/test_utils.h"
+#include "content/shell/browser/shell.h"
+#include "net/dns/mock_host_resolver.h"
+#include "net/test/embedded_test_server/embedded_test_server.h"
+
+namespace content {
+
+// This class currently enables the network service feature, which allows us to
+// test the AppCache code in that mode.
+class AppCacheNetworkServiceBrowserTest : public ContentBrowserTest {
+public:
+ AppCacheNetworkServiceBrowserTest() {}
+
+protected:
+ void SetUpCommandLine(base::CommandLine* command_line) override {
+ command_line->AppendSwitchASCII("enable-features",
jam 2017/07/25 01:00:05 nit: use content::kEnableFeatures
ananta 2017/07/25 01:14:28 Done.
+ features::kNetworkService.name);
jam 2017/07/25 01:00:05 nit: indentation
ananta 2017/07/25 01:14:28 Done.
+ }
+
+ void SetUpOnMainThread() override {
+ host_resolver()->AddRule("*", "127.0.0.1");
jam 2017/07/25 01:00:05 are you sure you need this? this is for tests that
ananta 2017/07/25 01:14:28 Thanks. Removed.
+ ASSERT_TRUE(embedded_test_server()->Start());
+ }
+};
+
+// This test validates that navigating to a TLD which has an AppCache
+// associated with it and then navigating to another TLD within that
+// host does not hang.
+IN_PROC_BROWSER_TEST_F(AppCacheNetworkServiceBrowserTest,
+ VerifySubresourceFactoryClearedOnNewNavigation) {
+ if (!base::FeatureList::IsEnabled(features::kNetworkService))
jam 2017/07/25 01:00:05 nit: this isn't needed since the test sets it
ananta 2017/07/25 01:14:28 Removed
+ return;
+
+ GURL main_url = embedded_test_server()->GetURL(
+ "/appcache/simple_page_with_manifest.html");
+
+ TitleWatcher title_watcher(shell()->web_contents(), L"AppCache updated");
+
+ // Load the main page twice. The second navigation should have AppCache
+ // initialized for the page.
+ EXPECT_TRUE(NavigateToURL(shell(), main_url));
+ EXPECT_EQ(title_watcher.WaitAndGetTitle(), L"AppCache updated");
+
+ TestNavigationObserver observer(shell()->web_contents());
+ EXPECT_TRUE(NavigateToURL(shell(), main_url));
+ EXPECT_EQ(main_url, observer.last_navigation_url());
+ EXPECT_TRUE(observer.last_navigation_succeeded());
+
+ GURL page_no_manifest = embedded_test_server()->GetURL(
+ "/appcache/simple_page_no_manifest.html");
+
+ EXPECT_TRUE(NavigateToURL(shell(), page_no_manifest));
+ EXPECT_EQ(page_no_manifest, observer.last_navigation_url());
+ EXPECT_TRUE(observer.last_navigation_succeeded());
+}
+
+} // namespace content
« no previous file with comments | « no previous file | content/browser/appcache/appcache_subresource_url_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698