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

Side by Side Diff: chrome/browser/ui/pdf/pdf_browsertest.cc

Issue 10828380: Convert the pdf PerformPDFAction pyauto test to a browser test. While at it, verify that… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 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
« no previous file with comments | « no previous file | chrome/test/functional/PYAUTO_TESTS » ('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) 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 337
338 // Check if the LOAD_STOP notification could have come while we run a 338 // Check if the LOAD_STOP notification could have come while we run a
339 // nested message loop for the JS call. 339 // nested message loop for the JS call.
340 if (last_count != load_stop_notification_count()) 340 if (last_count != load_stop_notification_count())
341 continue; 341 continue;
342 content::WaitForLoadStop(chrome::GetActiveWebContents(browser())); 342 content::WaitForLoadStop(chrome::GetActiveWebContents(browser()));
343 } 343 }
344 } 344 }
345 } 345 }
346 346
347 IN_PROC_BROWSER_TEST_F(PDFBrowserTest, Action) {
348 ASSERT_NO_FATAL_FAILURE(Load());
349
350 ASSERT_TRUE(content::ExecuteJavaScript(
351 chrome::GetActiveWebContents(browser())->GetRenderViewHost(),
352 std::wstring(),
353 L"document.getElementsByName('plugin')[0].fitToHeight();"));
354
355 std::string zoom1, zoom2;
356 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString(
357 chrome::GetActiveWebContents(browser())->GetRenderViewHost(),
358 std::wstring(),
359 L"window.domAutomationController.send("
360 L"document.getElementsByName('plugin')[0].getZoomLevel().toString())",
361 &zoom1));
362
363 ASSERT_TRUE(content::ExecuteJavaScript(
364 chrome::GetActiveWebContents(browser())->GetRenderViewHost(),
365 std::wstring(),
366 L"document.getElementsByName('plugin')[0].fitToWidth();"));
367
368 ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString(
369 chrome::GetActiveWebContents(browser())->GetRenderViewHost(),
370 std::wstring(),
371 L"window.domAutomationController.send("
372 L"document.getElementsByName('plugin')[0].getZoomLevel().toString())",
373 &zoom2));
374 ASSERT_NE(zoom1, zoom2);
cevans 2012/08/18 00:51:55 Is the width/height of the browser window sufficie
jam 2012/08/18 00:57:05 Load() resizes the browser to 1000x600 and ensures
375 }
376
377
347 // Flaky as per http://crbug.com/74549. 378 // Flaky as per http://crbug.com/74549.
348 IN_PROC_BROWSER_TEST_F(PDFBrowserTest, DISABLED_OnLoadAndReload) { 379 IN_PROC_BROWSER_TEST_F(PDFBrowserTest, DISABLED_OnLoadAndReload) {
349 ASSERT_TRUE(pdf_test_server()->Start()); 380 ASSERT_TRUE(pdf_test_server()->Start());
350 381
351 GURL url = pdf_test_server()->GetURL("files/onload_reload.html"); 382 GURL url = pdf_test_server()->GetURL("files/onload_reload.html");
352 ui_test_utils::NavigateToURL(browser(), url); 383 ui_test_utils::NavigateToURL(browser(), url);
353 384
354 content::WindowedNotificationObserver observer( 385 content::WindowedNotificationObserver observer(
355 content::NOTIFICATION_LOAD_STOP, 386 content::NOTIFICATION_LOAD_STOP,
356 content::Source<NavigationController>( 387 content::Source<NavigationController>(
357 &chrome::GetActiveWebContents(browser())->GetController())); 388 &chrome::GetActiveWebContents(browser())->GetController()));
358 ASSERT_TRUE(content::ExecuteJavaScript( 389 ASSERT_TRUE(content::ExecuteJavaScript(
359 chrome::GetActiveWebContents(browser())->GetRenderViewHost(), 390 chrome::GetActiveWebContents(browser())->GetRenderViewHost(),
360 std::wstring(), 391 std::wstring(),
361 L"reloadPDF();")); 392 L"reloadPDF();"));
362 observer.Wait(); 393 observer.Wait();
363 394
364 ASSERT_EQ("success", 395 ASSERT_EQ("success",
365 chrome::GetActiveWebContents(browser())->GetURL().query()); 396 chrome::GetActiveWebContents(browser())->GetURL().query());
366 } 397 }
367 398
368 } // namespace 399 } // namespace
OLDNEW
« no previous file with comments | « no previous file | chrome/test/functional/PYAUTO_TESTS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698