| Index: chrome/browser/browser_keyevents_browsertest.cc
|
| ===================================================================
|
| --- chrome/browser/browser_keyevents_browsertest.cc (revision 174946)
|
| +++ chrome/browser/browser_keyevents_browsertest.cc (working copy)
|
| @@ -35,24 +35,24 @@
|
| namespace {
|
|
|
| const char kTestingPage[] = "files/keyevents_test.html";
|
| -const char kSuppressEventJS[] =
|
| - "window.domAutomationController.send(setDefaultAction('%ls', %ls));";
|
| -const char kGetResultJS[] =
|
| - "window.domAutomationController.send(keyEventResult[%d]);";
|
| -const char kGetResultLengthJS[] =
|
| - "window.domAutomationController.send(keyEventResult.length);";
|
| -const char kGetFocusedElementJS[] =
|
| - "window.domAutomationController.send(focusedElement);";
|
| -const char kSetFocusedElementJS[] =
|
| - "window.domAutomationController.send(setFocusedElement('%ls'));";
|
| -const char kGetTextBoxValueJS[] =
|
| - "window.domAutomationController.send("
|
| - " document.getElementById('%ls').value);";
|
| -const char kSetTextBoxValueJS[] =
|
| - "window.domAutomationController.send("
|
| - " document.getElementById('%ls').value = '%ls');";
|
| -const char kStartTestJS[] =
|
| - "window.domAutomationController.send(startTest(%d));";
|
| +const wchar_t kSuppressEventJS[] =
|
| + L"window.domAutomationController.send(setDefaultAction('%ls', %ls));";
|
| +const wchar_t kGetResultJS[] =
|
| + L"window.domAutomationController.send(keyEventResult[%d]);";
|
| +const wchar_t kGetResultLengthJS[] =
|
| + L"window.domAutomationController.send(keyEventResult.length);";
|
| +const wchar_t kGetFocusedElementJS[] =
|
| + L"window.domAutomationController.send(focusedElement);";
|
| +const wchar_t kSetFocusedElementJS[] =
|
| + L"window.domAutomationController.send(setFocusedElement('%ls'));";
|
| +const wchar_t kGetTextBoxValueJS[] =
|
| + L"window.domAutomationController.send("
|
| + L"document.getElementById('%ls').value);";
|
| +const wchar_t kSetTextBoxValueJS[] =
|
| + L"window.domAutomationController.send("
|
| + L"document.getElementById('%ls').value = '%ls');";
|
| +const wchar_t kStartTestJS[] =
|
| + L"window.domAutomationController.send(startTest(%d));";
|
|
|
| // Maximum lenght of the result array in KeyEventTestData structure.
|
| const size_t kMaxResultLength = 10;
|
| @@ -148,7 +148,7 @@
|
| bool actual;
|
| ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool(
|
| chrome::GetWebContentsAt(browser(), tab_index)->GetRenderViewHost(),
|
| - "",
|
| + L"",
|
| base::StringPrintf(kSuppressEventJS, type, GetBoolString(!suppress)),
|
| &actual));
|
| ASSERT_EQ(!suppress, actual);
|
| @@ -174,9 +174,7 @@
|
| ASSERT_LT(tab_index, browser()->tab_count());
|
| ASSERT_TRUE(content::ExecuteJavaScriptAndExtractInt(
|
| chrome::GetWebContentsAt(browser(), tab_index)->GetRenderViewHost(),
|
| - "",
|
| - kGetResultLengthJS,
|
| - length));
|
| + L"", kGetResultLengthJS, length));
|
| }
|
|
|
| void CheckResult(int tab_index, int length, const char* const result[]) {
|
| @@ -188,9 +186,7 @@
|
| std::string actual;
|
| ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString(
|
| chrome::GetWebContentsAt(browser(), tab_index)->GetRenderViewHost(),
|
| - "",
|
| - base::StringPrintf(kGetResultJS, i),
|
| - &actual));
|
| + L"", base::StringPrintf(kGetResultJS, i), &actual));
|
|
|
| // If more events were received than expected, then the additional events
|
| // must be keyup events.
|
| @@ -206,9 +202,7 @@
|
| std::string actual;
|
| ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString(
|
| chrome::GetWebContentsAt(browser(), tab_index)->GetRenderViewHost(),
|
| - "",
|
| - kGetFocusedElementJS,
|
| - &actual));
|
| + L"", kGetFocusedElementJS, &actual));
|
| ASSERT_EQ(WideToUTF8(focused), actual);
|
| }
|
|
|
| @@ -217,7 +211,7 @@
|
| bool actual;
|
| ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool(
|
| chrome::GetWebContentsAt(browser(), tab_index)->GetRenderViewHost(),
|
| - "",
|
| + L"",
|
| base::StringPrintf(kSetFocusedElementJS, focused),
|
| &actual));
|
| ASSERT_TRUE(actual);
|
| @@ -229,7 +223,7 @@
|
| std::string actual;
|
| ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString(
|
| chrome::GetWebContentsAt(browser(), tab_index)->GetRenderViewHost(),
|
| - "",
|
| + L"",
|
| base::StringPrintf(kGetTextBoxValueJS, id),
|
| &actual));
|
| ASSERT_EQ(WideToUTF8(value), actual);
|
| @@ -241,7 +235,7 @@
|
| std::string actual;
|
| ASSERT_TRUE(content::ExecuteJavaScriptAndExtractString(
|
| chrome::GetWebContentsAt(browser(), tab_index)->GetRenderViewHost(),
|
| - "",
|
| + L"",
|
| base::StringPrintf(kSetTextBoxValueJS, id, value),
|
| &actual));
|
| ASSERT_EQ(WideToUTF8(value), actual);
|
| @@ -252,9 +246,7 @@
|
| bool actual;
|
| ASSERT_TRUE(content::ExecuteJavaScriptAndExtractBool(
|
| chrome::GetWebContentsAt(browser(), tab_index)->GetRenderViewHost(),
|
| - "",
|
| - base::StringPrintf(kStartTestJS, result_length),
|
| - &actual));
|
| + L"", base::StringPrintf(kStartTestJS, result_length), &actual));
|
| ASSERT_TRUE(actual);
|
| }
|
|
|
|
|