OLD | NEW |
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/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 // document, it'll wait for us to flush the renderer message loop twice and | 100 // document, it'll wait for us to flush the renderer message loop twice and |
101 // also the browser's once, at which point we're guaranteed to have updated | 101 // also the browser's once, at which point we're guaranteed to have updated |
102 // the backingstore. Hacky, but it works. | 102 // the backingstore. Hacky, but it works. |
103 // Note that we need to change the text each time, because if we don't the | 103 // Note that we need to change the text each time, because if we don't the |
104 // renderer code will think the second message is to go to next result, but | 104 // renderer code will think the second message is to go to next result, but |
105 // there are none so the plugin will assert. | 105 // there are none so the plugin will assert. |
106 | 106 |
107 string16 query = UTF8ToUTF16( | 107 string16 query = UTF8ToUTF16( |
108 std::string("xyzxyz" + base::IntToString(next_dummy_search_value_++))); | 108 std::string("xyzxyz" + base::IntToString(next_dummy_search_value_++))); |
109 ASSERT_EQ(0, ui_test_utils::FindInPage( | 109 ASSERT_EQ(0, ui_test_utils::FindInPage( |
110 chrome::GetActiveTabContents(browser()), query, true, false, NULL)); | 110 chrome::GetActiveTabContents(browser()), query, true, false, NULL, |
| 111 NULL)); |
111 } | 112 } |
112 | 113 |
113 private: | 114 private: |
114 // content::NotificationObserver | 115 // content::NotificationObserver |
115 virtual void Observe(int type, | 116 virtual void Observe(int type, |
116 const content::NotificationSource& source, | 117 const content::NotificationSource& source, |
117 const content::NotificationDetails& details) { | 118 const content::NotificationDetails& details) { |
118 if (type == chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN) { | 119 if (type == chrome::NOTIFICATION_TAB_SNAPSHOT_TAKEN) { |
119 MessageLoopForUI::current()->Quit(); | 120 MessageLoopForUI::current()->Quit(); |
120 FilePath reference = ui_test_utils::GetTestFilePath( | 121 FilePath reference = ui_test_utils::GetTestFilePath( |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 // TODO(sanjeevr): http://crbug.com/79837 | 258 // TODO(sanjeevr): http://crbug.com/79837 |
258 #define MAYBE_FindAndCopy DISABLED_FindAndCopy | 259 #define MAYBE_FindAndCopy DISABLED_FindAndCopy |
259 #else | 260 #else |
260 #define MAYBE_FindAndCopy FindAndCopy | 261 #define MAYBE_FindAndCopy FindAndCopy |
261 #endif | 262 #endif |
262 IN_PROC_BROWSER_TEST_F(PDFBrowserTest, MAYBE_FindAndCopy) { | 263 IN_PROC_BROWSER_TEST_F(PDFBrowserTest, MAYBE_FindAndCopy) { |
263 ASSERT_NO_FATAL_FAILURE(Load()); | 264 ASSERT_NO_FATAL_FAILURE(Load()); |
264 // Verifies that find in page works. | 265 // Verifies that find in page works. |
265 ASSERT_EQ(3, ui_test_utils::FindInPage( | 266 ASSERT_EQ(3, ui_test_utils::FindInPage( |
266 chrome::GetActiveTabContents(browser()), UTF8ToUTF16("adipiscing"), | 267 chrome::GetActiveTabContents(browser()), UTF8ToUTF16("adipiscing"), |
267 true, false, NULL)); | 268 true, false, NULL, NULL)); |
268 | 269 |
269 // Verify that copying selected text works. | 270 // Verify that copying selected text works. |
270 ui::Clipboard clipboard; | 271 ui::Clipboard clipboard; |
271 // Reset the clipboard first. | 272 // Reset the clipboard first. |
272 ui::Clipboard::ObjectMap objects; | 273 ui::Clipboard::ObjectMap objects; |
273 ui::Clipboard::ObjectMapParams params; | 274 ui::Clipboard::ObjectMapParams params; |
274 params.push_back(std::vector<char>()); | 275 params.push_back(std::vector<char>()); |
275 objects[ui::Clipboard::CBF_TEXT] = params; | 276 objects[ui::Clipboard::CBF_TEXT] = params; |
276 clipboard.WriteObjects(ui::Clipboard::BUFFER_STANDARD, objects); | 277 clipboard.WriteObjects(ui::Clipboard::BUFFER_STANDARD, objects); |
277 | 278 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), | 358 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), |
358 std::wstring(), | 359 std::wstring(), |
359 L"reloadPDF();")); | 360 L"reloadPDF();")); |
360 observer.Wait(); | 361 observer.Wait(); |
361 | 362 |
362 ASSERT_EQ("success", | 363 ASSERT_EQ("success", |
363 chrome::GetActiveWebContents(browser())->GetURL().query()); | 364 chrome::GetActiveWebContents(browser())->GetURL().query()); |
364 } | 365 } |
365 | 366 |
366 } // namespace | 367 } // namespace |
OLD | NEW |