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

Side by Side Diff: content/browser/debugger/devtools_manager_unittest.cc

Issue 9706012: Add abstractions that let embedders drive tests of WebContents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove CONTENT_EXPORT on statically linked functions. Merge to head for commit. Created 8 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 | Annotate | Revision Log
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/time.h" 6 #include "base/time.h"
7 #include "content/browser/debugger/devtools_manager_impl.h" 7 #include "content/browser/debugger/devtools_manager_impl.h"
8 #include "content/browser/debugger/render_view_devtools_agent_host.h" 8 #include "content/browser/debugger/render_view_devtools_agent_host.h"
9 #include "content/browser/mock_content_browser_client.h" 9 #include "content/browser/mock_content_browser_client.h"
10 #include "content/browser/renderer_host/test_render_view_host.h" 10 #include "content/browser/renderer_host/test_render_view_host.h"
11 #include "content/browser/tab_contents/test_tab_contents.h" 11 #include "content/browser/tab_contents/test_tab_contents.h"
12 #include "content/common/view_messages.h" 12 #include "content/common/view_messages.h"
13 #include "content/public/browser/content_browser_client.h" 13 #include "content/public/browser/content_browser_client.h"
14 #include "content/public/browser/devtools_agent_host_registry.h" 14 #include "content/public/browser/devtools_agent_host_registry.h"
15 #include "content/public/browser/devtools_client_host.h" 15 #include "content/public/browser/devtools_client_host.h"
16 #include "content/public/browser/web_contents_delegate.h" 16 #include "content/public/browser/web_contents_delegate.h"
17 #include "content/browser/tab_contents/test_tab_contents.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 19
19 using base::TimeDelta; 20 using base::TimeDelta;
20 using content::DevToolsAgentHost; 21 using content::DevToolsAgentHost;
21 using content::DevToolsAgentHostRegistry; 22 using content::DevToolsAgentHostRegistry;
22 using content::DevToolsClientHost; 23 using content::DevToolsClientHost;
23 using content::DevToolsManager; 24 using content::DevToolsManager;
24 using content::DevToolsManagerImpl; 25 using content::DevToolsManagerImpl;
25 using content::RenderViewHostImplTestHarness; 26 using content::RenderViewHostImplTestHarness;
26 using content::WebContents; 27 using content::WebContents;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 class DevToolsManagerTest : public RenderViewHostImplTestHarness { 116 class DevToolsManagerTest : public RenderViewHostImplTestHarness {
116 public: 117 public:
117 DevToolsManagerTest() { 118 DevToolsManagerTest() {
118 } 119 }
119 120
120 protected: 121 protected:
121 virtual void SetUp() OVERRIDE { 122 virtual void SetUp() OVERRIDE {
122 original_browser_client_ = content::GetContentClient()->browser(); 123 original_browser_client_ = content::GetContentClient()->browser();
123 content::GetContentClient()->set_browser(&browser_client_); 124 content::GetContentClient()->set_browser(&browser_client_);
124 125
125 RenderViewHostTestHarness::SetUp(); 126 RenderViewHostImplTestHarness::SetUp();
126 TestDevToolsClientHost::ResetCounters(); 127 TestDevToolsClientHost::ResetCounters();
127 } 128 }
128 129
129 virtual void TearDown() OVERRIDE { 130 virtual void TearDown() OVERRIDE {
130 RenderViewHostTestHarness::TearDown(); 131 RenderViewHostImplTestHarness::TearDown();
131 content::GetContentClient()->set_browser(original_browser_client_); 132 content::GetContentClient()->set_browser(original_browser_client_);
132 } 133 }
133 134
134 private: 135 private:
135 content::ContentBrowserClient* original_browser_client_; 136 content::ContentBrowserClient* original_browser_client_;
136 DevToolsManagerTestBrowserClient browser_client_; 137 DevToolsManagerTestBrowserClient browser_client_;
137 }; 138 };
138 139
139 TEST_F(DevToolsManagerTest, OpenAndManuallyCloseDevToolsClientHost) { 140 TEST_F(DevToolsManagerTest, OpenAndManuallyCloseDevToolsClientHost) {
140 DevToolsManagerImpl manager; 141 DevToolsManagerImpl manager;
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 240
240 // Interrupt pending navigation and navigate back to the original site. 241 // Interrupt pending navigation and navigate back to the original site.
241 controller().LoadURL( 242 controller().LoadURL(
242 url, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string()); 243 url, content::Referrer(), content::PAGE_TRANSITION_TYPED, std::string());
243 contents()->TestDidNavigate(rvh(), 1, url, content::PAGE_TRANSITION_TYPED); 244 contents()->TestDidNavigate(rvh(), 1, url, content::PAGE_TRANSITION_TYPED);
244 EXPECT_FALSE(contents()->cross_navigation_pending()); 245 EXPECT_FALSE(contents()->cross_navigation_pending());
245 EXPECT_EQ(&client_host, devtools_manager->GetDevToolsClientHostFor( 246 EXPECT_EQ(&client_host, devtools_manager->GetDevToolsClientHostFor(
246 DevToolsAgentHostRegistry::GetDevToolsAgentHost(rvh()))); 247 DevToolsAgentHostRegistry::GetDevToolsAgentHost(rvh())));
247 client_host.Close(DevToolsManager::GetInstance()); 248 client_host.Close(DevToolsManager::GetInstance());
248 } 249 }
OLDNEW
« no previous file with comments | « chrome/test/base/chrome_render_view_host_test_harness.cc ('k') | content/browser/download/save_package_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698