| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/scoped_ptr.h" | 6 #include "base/scoped_ptr.h" |
| 7 #include "chrome/common/chrome_switches.h" | 7 #include "chrome/common/chrome_switches.h" |
| 8 #include "chrome/test/automation/browser_proxy.h" | 8 #include "chrome/test/automation/browser_proxy.h" |
| 9 #include "chrome/test/automation/tab_proxy.h" | 9 #include "chrome/test/automation/tab_proxy.h" |
| 10 #include "chrome/test/ui/ui_test.h" | 10 #include "chrome/test/ui/ui_test.h" |
| 11 #include "net/url_request/url_request_unittest.h" | 11 #include "net/url_request/url_request_unittest.h" |
| 12 | 12 |
| 13 class InspectorControllerTest : public UITest { | 13 class InspectorControllerTest : public UITest { |
| 14 protected: | 14 protected: |
| 15 TabProxy* GetActiveTabProxy() { | 15 scoped_refptr<TabProxy> GetActiveTabProxy() { |
| 16 scoped_ptr<BrowserProxy> window_proxy(automation()->GetBrowserWindow(0)); | 16 scoped_refptr<BrowserProxy> window_proxy(automation()->GetBrowserWindow(0)); |
| 17 EXPECT_TRUE(window_proxy.get()); | 17 EXPECT_TRUE(window_proxy.get()); |
| 18 | 18 |
| 19 int active_tab_index = 0; | 19 int active_tab_index = 0; |
| 20 EXPECT_TRUE(window_proxy->GetActiveTabIndex(&active_tab_index)); | 20 EXPECT_TRUE(window_proxy->GetActiveTabIndex(&active_tab_index)); |
| 21 return window_proxy->GetTab(active_tab_index); | 21 return window_proxy->GetTab(active_tab_index); |
| 22 } | 22 } |
| 23 | 23 |
| 24 void NavigateTab(TabProxy* tab_proxy, const GURL& url) { | 24 void NavigateTab(TabProxy* tab_proxy, const GURL& url) { |
| 25 ASSERT_TRUE(tab_proxy->NavigateToURL(url)); | 25 ASSERT_TRUE(tab_proxy->NavigateToURL(url)); |
| 26 } | 26 } |
| 27 }; | 27 }; |
| 28 | 28 |
| 29 // This test also does not work in single process. See http://b/1214920 | 29 // This test also does not work in single process. See http://b/1214920 |
| 30 // Disabled, see http://crbug.com/4655 | 30 // Disabled, see http://crbug.com/4655 |
| 31 TEST_F(InspectorControllerTest, DISABLED_InspectElement) { | 31 TEST_F(InspectorControllerTest, DISABLED_InspectElement) { |
| 32 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) | 32 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kSingleProcess)) |
| 33 return; | 33 return; |
| 34 | 34 |
| 35 scoped_refptr<HTTPTestServer> server = | 35 scoped_refptr<HTTPTestServer> server = |
| 36 HTTPTestServer::CreateServer(L"chrome/test/data", NULL); | 36 HTTPTestServer::CreateServer(L"chrome/test/data", NULL); |
| 37 ASSERT_TRUE(NULL != server.get()); | 37 ASSERT_TRUE(NULL != server.get()); |
| 38 | 38 |
| 39 ::scoped_ptr<TabProxy> tab(GetActiveTabProxy()); | 39 scoped_refptr<TabProxy> tab(GetActiveTabProxy()); |
| 40 // We don't track resources until we've opened the inspector. | 40 // We don't track resources until we've opened the inspector. |
| 41 NavigateTab(tab.get(), server->TestServerPageW( | 41 NavigateTab(tab.get(), server->TestServerPageW( |
| 42 L"files/inspector/test1.html")); | 42 L"files/inspector/test1.html")); |
| 43 tab->InspectElement(0, 0); | 43 tab->InspectElement(0, 0); |
| 44 NavigateTab(tab.get(), server->TestServerPageW( | 44 NavigateTab(tab.get(), server->TestServerPageW( |
| 45 L"files/inspector/test1.html")); | 45 L"files/inspector/test1.html")); |
| 46 EXPECT_EQ(1, tab->InspectElement(0, 0)); | 46 EXPECT_EQ(1, tab->InspectElement(0, 0)); |
| 47 NavigateTab(tab.get(), server->TestServerPageW( | 47 NavigateTab(tab.get(), server->TestServerPageW( |
| 48 L"files/inspector/test2.html")); | 48 L"files/inspector/test2.html")); |
| 49 EXPECT_EQ(2, tab->InspectElement(0, 0)); | 49 EXPECT_EQ(2, tab->InspectElement(0, 0)); |
| 50 } | 50 } |
| OLD | NEW |