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

Side by Side Diff: chrome/browser/browser_focus_uitest.cc

Issue 193101: Fix to use FilePath in more unittests. (Closed)
Patch Set: Created 11 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 unified diff | Download patch
« no previous file with comments | « base/sys_info_unittest.cc ('k') | chrome/browser/importer/firefox_profile_lock_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/keyboard_codes.h" 5 #include "base/keyboard_codes.h"
6 #include "base/message_loop.h" 6 #include "base/message_loop.h"
7 #include "base/ref_counted.h" 7 #include "base/ref_counted.h"
8 #include "chrome/browser/automation/ui_controls.h" 8 #include "chrome/browser/automation/ui_controls.h"
9 #include "chrome/browser/browser.h" 9 #include "chrome/browser/browser.h"
10 #include "chrome/browser/browser_window.h" 10 #include "chrome/browser/browser_window.h"
(...skipping 30 matching lines...) Expand all
41 41
42 namespace { 42 namespace {
43 43
44 // The delay waited in some cases where we don't have a notifications for an 44 // The delay waited in some cases where we don't have a notifications for an
45 // action we take. 45 // action we take.
46 const int kActionDelayMs = 500; 46 const int kActionDelayMs = 500;
47 47
48 const wchar_t kSimplePage[] = L"files/focus/page_with_focus.html"; 48 const wchar_t kSimplePage[] = L"files/focus/page_with_focus.html";
49 const wchar_t kStealFocusPage[] = L"files/focus/page_steals_focus.html"; 49 const wchar_t kStealFocusPage[] = L"files/focus/page_steals_focus.html";
50 const wchar_t kTypicalPage[] = L"files/focus/typical_page.html"; 50 const wchar_t kTypicalPage[] = L"files/focus/typical_page.html";
51 const wchar_t kTypicalPageName[] = L"typical_page.html"; 51 const char kTypicalPageName[] = "typical_page.html";
52 52
53 class BrowserFocusTest : public InProcessBrowserTest { 53 class BrowserFocusTest : public InProcessBrowserTest {
54 public: 54 public:
55 BrowserFocusTest() { 55 BrowserFocusTest() {
56 set_show_window(true); 56 set_show_window(true);
57 EnableDOMAutomation(); 57 EnableDOMAutomation();
58 } 58 }
59 59
60 void CheckViewHasFocus(ViewID vid) { 60 void CheckViewHasFocus(ViewID vid) {
61 BrowserWindow* browser_window = browser()->window(); 61 BrowserWindow* browser_window = browser()->window();
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 return false; 141 return false;
142 } 142 }
143 #endif 143 #endif
144 }; 144 };
145 145
146 class TestInterstitialPage : public InterstitialPage { 146 class TestInterstitialPage : public InterstitialPage {
147 public: 147 public:
148 TestInterstitialPage(TabContents* tab, bool new_navigation, const GURL& url) 148 TestInterstitialPage(TabContents* tab, bool new_navigation, const GURL& url)
149 : InterstitialPage(tab, new_navigation, url), 149 : InterstitialPage(tab, new_navigation, url),
150 waiting_for_dom_response_(false) { 150 waiting_for_dom_response_(false) {
151 std::wstring file_path; 151 FilePath file_path;
152 bool r = PathService::Get(chrome::DIR_TEST_DATA, &file_path); 152 bool r = PathService::Get(chrome::DIR_TEST_DATA, &file_path);
153 EXPECT_TRUE(r); 153 EXPECT_TRUE(r);
154 file_util::AppendToPath(&file_path, L"focus"); 154 file_path = file_path.AppendASCII("focus");
155 file_util::AppendToPath(&file_path, kTypicalPageName); 155 file_path = file_path.AppendASCII(kTypicalPageName);
156 r = file_util::ReadFileToString(file_path, &html_contents_); 156 r = file_util::ReadFileToString(file_path, &html_contents_);
157 EXPECT_TRUE(r); 157 EXPECT_TRUE(r);
158 } 158 }
159 159
160 virtual std::string GetHTMLContents() { 160 virtual std::string GetHTMLContents() {
161 return html_contents_; 161 return html_contents_;
162 } 162 }
163 163
164 virtual void DomOperationResponse(const std::string& json_string, 164 virtual void DomOperationResponse(const std::string& json_string,
165 int automation_id) { 165 int automation_id) {
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after
702 702
703 // Open a regular page, crash, reload. 703 // Open a regular page, crash, reload.
704 ui_test_utils::NavigateToURL(browser(), server->TestServerPageW(kSimplePage)); 704 ui_test_utils::NavigateToURL(browser(), server->TestServerPageW(kSimplePage));
705 ui_test_utils::CrashTab(browser()->GetSelectedTabContents()); 705 ui_test_utils::CrashTab(browser()->GetSelectedTabContents());
706 browser()->Reload(); 706 browser()->Reload();
707 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); 707 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser()));
708 // Focus should now be on the tab contents. 708 // Focus should now be on the tab contents.
709 browser()->ShowDownloadsTab(); 709 browser()->ShowDownloadsTab();
710 CheckViewHasFocus(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW); 710 CheckViewHasFocus(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW);
711 } 711 }
OLDNEW
« no previous file with comments | « base/sys_info_unittest.cc ('k') | chrome/browser/importer/firefox_profile_lock_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698