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

Side by Side Diff: chrome/test/automation/automation_proxy_uitest.cc

Issue 18248: CommandLine API rework (Closed)
Patch Set: fixes Created 11 years, 11 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
OLDNEW
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 <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "chrome/app/chrome_dll_resource.h" 10 #include "chrome/app/chrome_dll_resource.h"
11 #include "chrome/browser/view_ids.h" 11 #include "chrome/browser/view_ids.h"
12 #include "chrome/common/chrome_constants.h" 12 #include "chrome/common/chrome_constants.h"
13 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 #include "chrome/common/json_value_serializer.h" 14 #include "chrome/common/json_value_serializer.h"
15 #include "chrome/test/automation/constrained_window_proxy.h" 15 #include "chrome/test/automation/constrained_window_proxy.h"
16 #include "chrome/test/automation/browser_proxy.h" 16 #include "chrome/test/automation/browser_proxy.h"
17 #include "chrome/test/automation/tab_proxy.h" 17 #include "chrome/test/automation/tab_proxy.h"
18 #include "chrome/test/automation/window_proxy.h" 18 #include "chrome/test/automation/window_proxy.h"
19 #include "chrome/test/ui/ui_test.h" 19 #include "chrome/test/ui/ui_test.h"
20 #include "chrome/views/dialog_delegate.h" 20 #include "chrome/views/dialog_delegate.h"
21 #include "chrome/views/event.h" 21 #include "chrome/views/event.h"
22 #include "net/base/net_util.h" 22 #include "net/base/net_util.h"
23 23
24 class AutomationProxyTest : public UITest { 24 class AutomationProxyTest : public UITest {
25 protected: 25 protected:
26 AutomationProxyTest() { 26 AutomationProxyTest() {
27 dom_automation_enabled_ = true; 27 dom_automation_enabled_ = true;
28 CommandLine::AppendSwitchWithValue(&launch_arguments_, 28 launch_arguments_.AppendSwitchWithValue(switches::kLang,
29 switches::kLang, 29 L"en-us");
30 L"en-us");
31 } 30 }
32 }; 31 };
33 32
34 class AutomationProxyVisibleTest : public UITest { 33 class AutomationProxyVisibleTest : public UITest {
35 protected: 34 protected:
36 AutomationProxyVisibleTest() { 35 AutomationProxyVisibleTest() {
37 show_window_ = true; 36 show_window_ = true;
38 } 37 }
39 }; 38 };
40 39
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 } 363 }
365 364
366 class AutomationProxyTest2 : public AutomationProxyVisibleTest { 365 class AutomationProxyTest2 : public AutomationProxyVisibleTest {
367 protected: 366 protected:
368 AutomationProxyTest2() { 367 AutomationProxyTest2() {
369 document1_ = test_data_directory_; 368 document1_ = test_data_directory_;
370 file_util::AppendToPath(&document1_, L"title1.html"); 369 file_util::AppendToPath(&document1_, L"title1.html");
371 370
372 document2_ = test_data_directory_; 371 document2_ = test_data_directory_;
373 file_util::AppendToPath(&document2_, L"title2.html"); 372 file_util::AppendToPath(&document2_, L"title2.html");
374 launch_arguments_ = document1_ + L" " + document2_; 373 launch_arguments_ = CommandLine(L"");
374 launch_arguments_.AppendLooseValue(document1_);
375 launch_arguments_.AppendLooseValue(document2_);
375 } 376 }
376 377
377 std::wstring document1_; 378 std::wstring document1_;
378 std::wstring document2_; 379 std::wstring document2_;
379 }; 380 };
380 381
381 TEST_F(AutomationProxyTest2, GetActiveTabIndex) { 382 TEST_F(AutomationProxyTest2, GetActiveTabIndex) {
382 scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0)); 383 scoped_ptr<BrowserProxy> window(automation()->GetBrowserWindow(0));
383 ASSERT_TRUE(window.get()); 384 ASSERT_TRUE(window.get());
384 385
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 // type value 570 // type value
570 571
571 class AutomationProxyTest3 : public UITest { 572 class AutomationProxyTest3 : public UITest {
572 protected: 573 protected:
573 AutomationProxyTest3() : UITest() { 574 AutomationProxyTest3() : UITest() {
574 document1_ = test_data_directory_; 575 document1_ = test_data_directory_;
575 file_util::AppendToPath(&document1_, L"frame_dom_access"); 576 file_util::AppendToPath(&document1_, L"frame_dom_access");
576 file_util::AppendToPath(&document1_, L"frame_dom_access.html"); 577 file_util::AppendToPath(&document1_, L"frame_dom_access.html");
577 578
578 dom_automation_enabled_ = true; 579 dom_automation_enabled_ = true;
579 launch_arguments_ = document1_; 580 launch_arguments_ = CommandLine(L"");
581 launch_arguments_.AppendLooseValue(document1_);
580 } 582 }
581 583
582 std::wstring document1_; 584 std::wstring document1_;
583 }; 585 };
584 586
585 std::wstring CreateJSStringForDOMQuery(const std::wstring& id) { 587 std::wstring CreateJSStringForDOMQuery(const std::wstring& id) {
586 std::wstring jscript(L"window.domAutomationController"); 588 std::wstring jscript(L"window.domAutomationController");
587 StringAppendF(&jscript, L".send(document.getElementById('%ls').nodeName);", 589 StringAppendF(&jscript, L".send(document.getElementById('%ls').nodeName);",
588 id.c_str()); 590 id.c_str());
589 return jscript; 591 return jscript;
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
901 // Click Cancel this time. 903 // Click Cancel this time.
902 EXPECT_TRUE(automation()->ClickAppModalDialogButton( 904 EXPECT_TRUE(automation()->ClickAppModalDialogButton(
903 views::DialogDelegate::DIALOGBUTTON_CANCEL)); 905 views::DialogDelegate::DIALOGBUTTON_CANCEL));
904 EXPECT_TRUE(automation()->GetShowingAppModalDialog(&modal_dialog_showing, 906 EXPECT_TRUE(automation()->GetShowingAppModalDialog(&modal_dialog_showing,
905 &button)); 907 &button));
906 EXPECT_FALSE(modal_dialog_showing); 908 EXPECT_FALSE(modal_dialog_showing);
907 EXPECT_TRUE(tab->ExecuteAndExtractInt( 909 EXPECT_TRUE(tab->ExecuteAndExtractInt(
908 L"", L"window.domAutomationController.send(result);", &result)); 910 L"", L"window.domAutomationController.send(result);", &result));
909 EXPECT_EQ(1, result); 911 EXPECT_EQ(1, result);
910 } 912 }
OLDNEW
« no previous file with comments | « chrome/test/automated_ui_tests/automated_ui_tests.cc ('k') | chrome/test/memory_test/memory_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698