This commit is contained in:
Ryan VanderMeulen 2013-08-23 16:56:55 -04:00
Родитель 94e3635b0f 5deeda5acb
Коммит b0e437cc42
15 изменённых файлов: 98 добавлений и 51 удалений

Просмотреть файл

@ -1723,7 +1723,7 @@
let closedTabs = 0;
for (let i = tabs.length - 1; i >= 0; --i) {
if (tabs[i] != aTab && !tabs[i].pinned) {
this.removeTab(tabs[i]);
this.removeTab(tabs[i], {animate: true});
closedTabs++;
}
}

Просмотреть файл

@ -3,6 +3,11 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
function test() {
Services.prefs.setBoolPref("browser.tabs.animate", false);
registerCleanupFunction(function() {
Services.prefs.clearUserPref("browser.tabs.animate");
});
// Open 2 other tabs, and pin the second one. Like that, the initial tab
// should get closed.
let testTab1 = gBrowser.addTab();

Просмотреть файл

@ -42,7 +42,9 @@ function verifyUndoMultipleClose() {
function test() {
waitForExplicitFinish();
Services.prefs.setBoolPref("browser.tabs.animate", false);
registerCleanupFunction(function() {
Services.prefs.clearUserPref("browser.tabs.animate");
originalTab.linkedBrowser.loadURI("about:blank");
originalTab = null;
});

Просмотреть файл

@ -157,9 +157,10 @@
window.setTimeout(loadURL, interval);
};
function loadURL () {
w.location.href = list[idx++];
w.close();
w = window.open(list[idx++]);
if (idx < list.length) {
window.setTimeout(loadURL, interval);
window.setTimeout(loadURL, interval);
} else {
window.setTimeout(goQuitApplication, interval);
}

Просмотреть файл

@ -138,6 +138,11 @@ class SearchEngineRow extends AnimatedHeightLayout {
});
}
private void setDescriptionOnSuggestion(View v, String suggestion) {
v.setContentDescription(getResources().getString(R.string.suggestion_for_engine,
mSearchEngine.name, suggestion));
}
private String getSuggestionTextFromView(View v) {
final TextView suggestionText = (TextView) v.findViewById(R.id.suggestion_text);
return suggestionText.getText().toString();
@ -146,10 +151,17 @@ class SearchEngineRow extends AnimatedHeightLayout {
private void setSuggestionOnView(View v, String suggestion) {
final TextView suggestionText = (TextView) v.findViewById(R.id.suggestion_text);
suggestionText.setText(suggestion);
setDescriptionOnSuggestion(suggestionText, suggestion);
}
public void setSearchTerm(String searchTerm) {
mUserEnteredTextView.setText(searchTerm);
// mSearchEngine is not set in the first call to this method; the content description
// is instead initially set in updateFromSearchEngine.
if (mSearchEngine != null) {
setDescriptionOnSuggestion(mUserEnteredTextView, searchTerm);
}
}
public void setOnUrlOpenListener(OnUrlOpenListener listener) {
@ -171,6 +183,9 @@ class SearchEngineRow extends AnimatedHeightLayout {
// Set the search engine icon (e.g., Google) for the row
mIconView.updateImage(mSearchEngine.icon, mSearchEngine.name);
// Set the initial content description
setDescriptionOnSuggestion(mUserEnteredTextView, mUserEnteredTextView.getText().toString());
// Add additional suggestions given by this engine
final int recycledSuggestionCount = mSuggestionView.getChildCount();
final int suggestionCount = mSearchEngine.suggestions.size();

Просмотреть файл

@ -333,6 +333,11 @@ just addresses the organization to follow, e.g. "This site is run by " -->
replaced with the name of the search engine. -->
<!ENTITY suggestions_prompt2 "Would you like to turn on &formatS; search suggestions?">
<!-- Localization note (suggestion_for_engine): The placeholder &formatS1; will be
replaced with the name of the search engine. The placeholder &formatS2; will be
replaced with the search query. -->
<!ENTITY suggestion_for_engine "Search &formatS1; for &formatS2;">
<!ENTITY webapp_generic_name "App">
<!ENTITY searchable_description "Bookmarks and history">

Просмотреть файл

@ -11,6 +11,8 @@
<!-- C-style format strings. -->
<!ENTITY formatS "&#037;s">
<!ENTITY formatS1 "&#037;1&#036;s">
<!ENTITY formatS2 "&#037;2&#036;s">
<!ENTITY formatD "&#037;d">
]>
@ -324,6 +326,8 @@
<!-- Search suggestions opt-in -->
<string name="suggestions_prompt">&suggestions_prompt2;</string>
<string name="suggestion_for_engine">&suggestion_for_engine;</string>
<!-- Set Image Notifications -->
<string name="set_image_fail">&set_image_fail;</string>
<string name="set_image_chooser_title">&set_image_chooser_title;</string>

Просмотреть файл

@ -121,40 +121,26 @@ abstract class AboutHomeTest extends BaseTest {
return null;
}
/**
* Adds a bookmark, or updates the bookmark title if the url already exists.
*
* The LocalBrowserDB.addBookmark implementation handles updating existing bookmarks.
* Since we don't modify bookmark keywords in tests, we don't need a separate
* implemention of updateBookmark.
*/
protected void addOrUpdateMobileBookmark(String title, String url) {
if (isBookmark(url)) {
updateBookmark(title, url, null);
} else {
addMobileBookmark(title, url);
}
}
protected void addMobileBookmark(String title, String url) {
try {
ContentResolver resolver = getActivity().getContentResolver();
ClassLoader classLoader = getActivity().getClassLoader();
Class browserDB = classLoader.loadClass("org.mozilla.gecko.db.BrowserDB");
Method addBookmark = browserDB.getMethod("addBookmark", ContentResolver.class, String.class, String.class);
addBookmark.invoke(null, resolver, title, url);
mAsserter.ok(true, "Inserting a new bookmark", "Inserter the bookmark with the title = " + title + " and the url = " + url);
mAsserter.ok(true, "Inserting/updating a new bookmark", "Inserting/updating the bookmark with the title = " + title + " and the url = " + url);
} catch (Exception e) {
mAsserter.ok(false, "Exception adding bookmark: ", e.toString());
}
}
protected void updateBookmark(String title, String url, String keyword) {
try {
ContentResolver resolver = getActivity().getContentResolver();
ClassLoader classLoader = getActivity().getClassLoader();
Class browserDB = classLoader.loadClass("org.mozilla.gecko.db.BrowserDB");
Method updateBookmark = browserDB.getMethod("updateBookmark", ContentResolver.class, String.class, String.class);
updateBookmark.invoke(null, resolver, title, url, keyword);
mAsserter.ok(true, "Updating existing bookmark", "Setting the values to title = " + title + ", url = " + url + " and keyword = " + keyword);
} catch (Exception e) {
mAsserter.ok(false, "Exception updating bookmark: ", e.toString());
}
}
protected void deleteBookmark(String url) {
try {
ContentResolver resolver = getActivity().getContentResolver();

Просмотреть файл

@ -28,7 +28,7 @@
[testDoorHanger]
[testTabHistory]
[testShareLink]
# [testClearPrivateData] # disabled on fig - bug 880060
[testClearPrivateData]
[testSettingsMenuItems]
[testSystemPages]
# [testPermissions] # see bug 757475

Просмотреть файл

@ -2,9 +2,11 @@
package @ANDROID_PACKAGE_NAME@.tests;
import @ANDROID_PACKAGE_NAME@.*;
import android.widget.ListView;
import java.util.ArrayList;
public class testClearPrivateData extends AboutHomeTest {
public class testClearPrivateData extends AboutHomeTest {
private final String BLANK1_TITLE = "Browser Blank Page 01";
private final String BLANK2_TITLE = "Browser Blank Page 02";
@Override
protected int getTestType() {
@ -17,29 +19,26 @@ public class testClearPrivateData extends AboutHomeTest {
}
private void clearHistory() {
// Loading a page so we are sure that there is at least one history entry
String url = getAbsoluteUrl("/robocop/robocop_blank_01.html");
inputAndLoadUrl(url);
// Loading a page and adding a second one as bookmark to have user made bookmarks and history
String blank1 = getAbsoluteUrl("/robocop/robocop_blank_01.html");
String blank2 = getAbsoluteUrl("/robocop/robocop_blank_02.html");
inputAndLoadUrl(blank1);
waitForText(BLANK1_TITLE);
addOrUpdateMobileBookmark(BLANK2_TITLE, blank2);
/* Removed by Bug 896576 - [fig] Remove [getHistoryList] from BaseTest
// Checking that the history list is not empty
ListView hList = getHistoryList("Today|Yesterday");
mAsserter.ok(hList.getAdapter().getCount() > 0,"checking history exists","history exists");
ArrayList<String> browserHistory = getBrowserDBUrls(BrowserDataType.HISTORY);
mAsserter.ok(browserHistory.size() > 0,"Checking history exists","History exists");
// Quit the awesomescreen
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
waitForText("Browser Blank Page 01");
// Clearing private data
selectSettingsItem("Privacy", "Clear private data");
mAsserter.ok(mSolo.searchButton("Clear data"),"checking clear button","clear button exists");
mSolo.clickOnButton("Clear data");
// TODO: extra long wait here for bug 837274
mAsserter.is(mSolo.waitForText("Private data cleared", 0, 60000),true,"private data cleared successfully");
clearPrivateData();
// Checking that history list is empty
hList = getHistoryList("History", 0);
mAsserter.ok(hList != null,"checking history is cleared ","history is cleared");
*/
browserHistory = getBrowserDBUrls(BrowserDataType.HISTORY);
mAsserter.ok(browserHistory.size() == 0,"Checking history is cleared ","History is cleared");
// Checking that the user made bookmark is not removed
mAsserter.ok(isBookmark(blank2), "Checking that bookmarks have not been removed", "User made bookmarks were not removed with private data");
}
}

Просмотреть файл

@ -110,7 +110,7 @@ public class testImportFromAndroid extends AboutHomeTest {
for (String url:androidBookmarks) {
// Add every 3rd bookmark to Firefox Mobile
if ((androidBookmarks.indexOf(url) % 3) == 0) {
addOrUpdateMobileBookmark("Bookmar Number" + String.valueOf(androidBookmarks.indexOf(url)), url);
addOrUpdateMobileBookmark("Bookmark Number " + String.valueOf(androidBookmarks.indexOf(url)), url);
}
}

Просмотреть файл

@ -111,6 +111,14 @@ class MochitestRunner(MozbuildObject):
opts = mochitest.MochitestOptions(automation)
options, args = opts.parse_args([])
appname = ''
if sys.platform.startswith('darwin'):
appname = os.path.join(self.distdir, self.substs['MOZ_MACBUNDLE_NAME'],
'Contents', 'MacOS', 'webapprt-stub' + automation.BIN_SUFFIX)
else:
appname = os.path.join(self.distdir, 'bin', 'webapprt-stub' +
automation.BIN_SUFFIX)
# Need to set the suite options before verifyOptions below.
if suite == 'plain':
# Don't need additional options for plain.
@ -124,6 +132,13 @@ class MochitestRunner(MozbuildObject):
options.browserChrome = True
elif suite == 'a11y':
options.a11y = True
elif suite == 'webapprt-content':
options.webapprtContent = True
options.app = appname
elif suite == 'webapprt-chrome':
options.webapprtChrome = True
options.app = appname
options.browserArgs.append("-test-mode")
else:
raise Exception('None or unrecognized mochitest suite type.')
@ -227,7 +242,7 @@ def MochitestCommand(func):
func = keep_open(func)
rerun = CommandArgument('--rerun-failures', action='store_true',
help='Run only the tests that filed during the last test run.')
help='Run only the tests that failed during the last test run.')
func = rerun(func)
autorun = CommandArgument('--no-autorun', action='store_true',
@ -290,6 +305,18 @@ class MachCommands(MachCommandBase):
def run_mochitest_a11y(self, test_file, **kwargs):
return self.run_mochitest(test_file, 'a11y', **kwargs)
@Command('webapprt-test-chrome', category='testing',
description='Run a webapprt chrome mochitest.')
@MochitestCommand
def run_mochitest_webapprt_chrome(self, test_file, **kwargs):
return self.run_mochitest(test_file, 'webapprt-chrome', **kwargs)
@Command('webapprt-test-content', category='testing',
description='Run a webapprt content mochitest.')
@MochitestCommand
def run_mochitest_webapprt_content(self, test_file, **kwargs):
return self.run_mochitest(test_file, 'webapprt-content', **kwargs)
def run_mochitest(self, test_file, flavor, **kwargs):
self._ensure_state_subdir_exists('.')

Просмотреть файл

@ -872,6 +872,7 @@ let test_system_shutdown = maketest("system_shutdown", function system_shutdown(
*/
let test_duration = maketest("duration", function duration(test) {
return Task.spawn(function() {
Services.prefs.setBoolPref("toolkit.osfile.log", true);
// Options structure passed to a OS.File copy method.
let copyOptions = {
// This field should be overridden with the actual duration
@ -947,12 +948,12 @@ let test_duration = maketest("duration", function duration(test) {
test.ok(copyOptions.outExecutionDuration >= backupDuration, "duration has increased 3");
OS.File.remove(pathDest);
Services.prefs.setBoolPref("toolkit.osfile.log", true);
OS.Shared.TEST = true;
// Testing an operation that doesn't take arguments at all
let file = yield OS.File.open(pathSource);
yield file.stat();
yield file.close();
Services.prefs.setBoolPref("toolkit.osfile.log", false);
});
});

Просмотреть файл

@ -70,7 +70,6 @@ treechildren:-moz-locale-dir(rtl)::-moz-tree-twisty(hover, open) {
-moz-margin-start: 1px;
-moz-margin-end: 1px;
border-width: 2px;
border-style: solid !important;
border-color: transparent;
border-radius: 3px;
background-repeat: no-repeat;
@ -89,6 +88,7 @@ treechildren:-moz-locale-dir(rtl)::-moz-tree-twisty(hover, open) {
}
treechildren::-moz-tree-row(current, focus) {
border-style: solid;
-moz-border-top-colors: @hoverAndFocusBorderColor@ @whiteOpacityBorderColor@;
-moz-border-right-colors: @hoverAndFocusBorderColor@ @whiteOpacityBorderColor@;
-moz-border-left-colors: @hoverAndFocusBorderColor@ @whiteOpacityBorderColor@;
@ -107,6 +107,7 @@ treechildren:-moz-locale-dir(rtl)::-moz-tree-twisty(hover, open) {
}
treechildren::-moz-tree-row(selected, current, focus) {
border-style: solid;
-moz-border-top-colors: @hoverAndFocusBorderColor@ @whiteOpacityBorderColor@;
-moz-border-right-colors: @hoverAndFocusBorderColor@ @whiteOpacityBorderColor@;
-moz-border-left-colors: @hoverAndFocusBorderColor@ @whiteOpacityBorderColor@;

Просмотреть файл

@ -61,6 +61,7 @@ tree[seltype="cell"] > treechildren::-moz-tree-row,
tree[seltype="text"] > treechildren::-moz-tree-row {
border: none;
background-color: transparent;
background-image: none;
}
/* ::::: tree cells ::::: */