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

Unified Diff: chrome/renderer/chrome_content_renderer_client_browsertest.cc

Issue 23455047: InstantExtended: Send search URLs to renderers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More browsertest fixes Created 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/chrome_content_renderer_client_browsertest.cc
diff --git a/chrome/renderer/chrome_content_renderer_client_browsertest.cc b/chrome/renderer/chrome_content_renderer_client_browsertest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..05474faa7fca044989c2ddc04fe87f8544045acb
--- /dev/null
+++ b/chrome/renderer/chrome_content_renderer_client_browsertest.cc
@@ -0,0 +1,50 @@
+// Copyright (c) 2013 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 "chrome/renderer/chrome_content_renderer_client.h"
+
+#include <vector>
+
+#include "base/command_line.h"
+#include "chrome/common/chrome_switches.h"
+#include "chrome/common/render_messages.h"
+#include "chrome/test/base/chrome_render_view_test.h"
+#include "url/gurl.h"
+
+namespace chrome {
+
+typedef ChromeRenderViewTest InstantProcessNavigationTest;
+
+// Tests that renderer-initiated navigations from an Instant render process get
+// bounced back to the browser to be rebucketed into a non-Instant renderer if
+// necessary.
+TEST_F(InstantProcessNavigationTest, ForkForNavigationsFromInstantProcess) {
+ CommandLine::ForCurrentProcess()->AppendSwitch(switches::kInstantProcess);
+ bool unused;
+ EXPECT_TRUE(chrome_content_renderer_client_.ShouldFork(
+ GetMainFrame(), GURL("http://foo"), "GET", false, false, &unused));
+}
+
+// Tests that renderer-initiated navigations from a non-Instant render process
+// to potentially Instant URLs get bounced back to the browser to be rebucketed
+// into an Instant renderer if necessary.
+TEST_F(InstantProcessNavigationTest, ForkForNavigationsToSearchURLs) {
+ chrome_content_renderer_client_.RenderThreadStarted();
+ std::vector<GURL> search_urls;
+ search_urls.push_back(GURL("http://example.com/search"));
+ chrome_render_thread_->Send(new ChromeViewMsg_SetSearchURLs(
+ search_urls, GURL("http://example.com/newtab")));
+ bool unused;
+ EXPECT_TRUE(chrome_content_renderer_client_.ShouldFork(
+ GetMainFrame(), GURL("http://example.com/newtab"), "GET", false, false,
+ &unused));
+ EXPECT_TRUE(chrome_content_renderer_client_.ShouldFork(
+ GetMainFrame(), GURL("http://example.com/search?q=foo"), "GET", false,
+ false, &unused));
+ EXPECT_FALSE(chrome_content_renderer_client_.ShouldFork(
+ GetMainFrame(), GURL("http://example.com/"), "GET", false, false,
+ &unused));
+}
+
+} // namespace chrome
« no previous file with comments | « chrome/renderer/chrome_content_renderer_client.cc ('k') | chrome/renderer/chrome_content_renderer_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698