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

Side by Side Diff: content/browser/frame_host/navigation_controller_impl_browsertest.cc

Issue 2684093002: Rename JavaScript "messages" to "dialogs". (Closed)
Patch Set: win fox Created 3 years, 10 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/browser/frame_host/navigation_controller_impl.h" 5 #include "content/browser/frame_host/navigation_controller_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 6214 matching lines...) Expand 10 before | Expand all | Expand 10 after
6225 EXPECT_TRUE(favicon_status2.valid); 6225 EXPECT_TRUE(favicon_status2.valid);
6226 6226
6227 ASSERT_TRUE(RendererLocationReplace(shell(), GURL("data:text/html,page2"))); 6227 ASSERT_TRUE(RendererLocationReplace(shell(), GURL("data:text/html,page2")));
6228 entry = controller.GetLastCommittedEntry(); 6228 entry = controller.GetLastCommittedEntry();
6229 content::FaviconStatus& favicon_status3 = entry->GetFavicon(); 6229 content::FaviconStatus& favicon_status3 = entry->GetFavicon();
6230 EXPECT_FALSE(favicon_status3.valid); 6230 EXPECT_FALSE(favicon_status3.valid);
6231 } 6231 }
6232 6232
6233 namespace { 6233 namespace {
6234 6234
6235 // A BrowserMessageFilter that delays the FrameHostMsg_RunJavaScriptMessage IPC 6235 // A BrowserMessageFilter that delays the FrameHostMsg_RunJavaScriptDialog IPC
6236 // message until a commit happens on a given WebContents. This allows testing a 6236 // message until a commit happens on a given WebContents. This allows testing a
6237 // race condition. 6237 // race condition.
6238 class AllowDialogIPCOnCommitFilter : public BrowserMessageFilter, 6238 class AllowDialogIPCOnCommitFilter : public BrowserMessageFilter,
6239 public WebContentsDelegate { 6239 public WebContentsDelegate {
6240 public: 6240 public:
6241 AllowDialogIPCOnCommitFilter(WebContents* web_contents) 6241 AllowDialogIPCOnCommitFilter(WebContents* web_contents)
6242 : BrowserMessageFilter(FrameMsgStart), 6242 : BrowserMessageFilter(FrameMsgStart),
6243 render_frame_host_(web_contents->GetMainFrame()) { 6243 render_frame_host_(web_contents->GetMainFrame()) {
6244 web_contents_observer_.Observe(web_contents); 6244 web_contents_observer_.Observe(web_contents);
6245 } 6245 }
6246 6246
6247 protected: 6247 protected:
6248 ~AllowDialogIPCOnCommitFilter() override {} 6248 ~AllowDialogIPCOnCommitFilter() override {}
6249 6249
6250 private: 6250 private:
6251 // BrowserMessageFilter: 6251 // BrowserMessageFilter:
6252 bool OnMessageReceived(const IPC::Message& message) override { 6252 bool OnMessageReceived(const IPC::Message& message) override {
6253 DCHECK_CURRENTLY_ON(BrowserThread::IO); 6253 DCHECK_CURRENTLY_ON(BrowserThread::IO);
6254 if (message.type() != FrameHostMsg_RunJavaScriptMessage::ID) 6254 if (message.type() != FrameHostMsg_RunJavaScriptDialog::ID)
6255 return false; 6255 return false;
6256 6256
6257 // Suspend the message. 6257 // Suspend the message.
6258 web_contents_observer_.SetCallback( 6258 web_contents_observer_.SetCallback(
6259 base::Bind(&RenderFrameHost::OnMessageReceived, 6259 base::Bind(&RenderFrameHost::OnMessageReceived,
6260 base::Unretained(render_frame_host_), message)); 6260 base::Unretained(render_frame_host_), message));
6261 return true; 6261 return true;
6262 } 6262 }
6263 6263
6264 // WebContentsDelegate: 6264 // WebContentsDelegate:
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
6697 NavigationHandleCommitObserver handle_observer(shell()->web_contents(), 6697 NavigationHandleCommitObserver handle_observer(shell()->web_contents(),
6698 kFragmentURL); 6698 kFragmentURL);
6699 EXPECT_TRUE(NavigateToURL(shell(), kFragmentURL)); 6699 EXPECT_TRUE(NavigateToURL(shell(), kFragmentURL));
6700 6700
6701 EXPECT_TRUE(handle_observer.has_committed()); 6701 EXPECT_TRUE(handle_observer.has_committed());
6702 EXPECT_TRUE(handle_observer.was_same_page()); 6702 EXPECT_TRUE(handle_observer.was_same_page());
6703 EXPECT_FALSE(handle_observer.was_renderer_initiated()); 6703 EXPECT_FALSE(handle_observer.was_renderer_initiated());
6704 } 6704 }
6705 6705
6706 } // namespace content 6706 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698