Closed Bug 772676 Opened 12 years ago Closed 12 years ago

History visit counts are all 1 after migration

Categories

(Firefox for Android Graveyard :: Data Providers, defect)

15 Branch
ARM
Android
defect
Not set
minor

Tracking

(firefox15+ fixed, firefox16+ fixed)

RESOLVED FIXED
Firefox 16
Tracking Status
firefox15 + fixed
firefox16 + fixed

People

(Reporter: gcp, Assigned: gcp)

Details

(Keywords: regression)

Attachments

(2 files)

Regression from bug 710330: after running Profile Migration the visit counts in the history database are all equal to 1.
Assignee: nobody → gpascutto
Attachment #641367 - Flags: review?(margaret.leibovic)
Also rename test* to runTest* so Robocop doesn't accidentally pick them up.
Attachment #641368 - Flags: review?(margaret.leibovic)
Attachment #641368 - Attachment is patch: true
Attachment #641367 - Flags: review?(margaret.leibovic) → review+
Comment on attachment 641368 [details] [diff] [review]
Patch 2. Add test for visit counts

>diff --git a/mobile/android/base/tests/testMigration.java.in b/mobile/android/base/tests/testMigration.java.in

>         try {
>             Class browserContract =
>                 mClassLoader.loadClass("org.mozilla.gecko.db.BrowserContract");
>             Class browserContractControl =
>                 mClassLoader.loadClass("org.mozilla.gecko.db.BrowserContract$Control");
>+            Class browserContractHistory =
>+                mClassLoader.loadClass("org.mozilla.gecko.db.BrowserContract$History");
>+            Class browserContractUrl =
>+                mClassLoader.loadClass("org.mozilla.gecko.db.BrowserContract$URLColumns");
>+            Class browserContractHistoryColumns =
>+                mClassLoader.loadClass("org.mozilla.gecko.db.BrowserContract$HistoryColumns");
>+
>             controlUri = (Uri)browserContractControl.getField("CONTENT_URI").get(null);
>+            historyUri = (Uri)browserContractHistory.getField("CONTENT_URI").get(null);
>+            urlField = (String)browserContractUrl.getField("URL").get(null);
>+            visitsField = (String)browserContractHistoryColumns.getField("VISITS").get(null);
>             String profilePath = (String)browserContract.getField("PARAM_PROFILE_PATH").get(null);
>             Uri.Builder builder = controlUri.buildUpon();
>             controlUri = builder.build();
>             ensureHistory =
>                 (String)browserContractControl.getField("ENSURE_HISTORY_MIGRATED").get(null);
>             ensureBookmarks =
>                 (String)browserContractControl.getField("ENSURE_BOOKMARKS_MIGRATED").get(null);
>         } catch (Exception ex) {

Nit: The error message that follows in here only talks about controlUri, but now there could be other things causing an exception here.

>+        // Check whether visits counts are as expected
>+        c = mResolver.query(historyUri,
>+                            new String[] { visitsField },
>+                            urlField  + " = ?",
>+                            new String[] { "http://www.reddit.com/" },
>+                            null);
>+        mAsserter.is(c.moveToFirst(), true, "Expected URL found");
>+        int visits = c.getInt(0);
>+        c.close();
>+
>+        mAsserter.is(visits, 4, "Visit count of " + visits + " equals expected 4");

Where does this URL/visit count come from? The test profile you're using for migration? Could you just add a comment about why this is expected? :)
Attachment #641368 - Flags: review?(margaret.leibovic) → review+
Since bug 710330 was landed in 16 I've marked 16 affected as well, please correct if I'm wrong.
Target Milestone: --- → Firefox 16
[Triage Comment]
This looks like a viable candidate for beta uplift, please nominate if that's correct.
Comment on attachment 641367 [details] [diff] [review]
Patch 1. Fix visit count adjusetment

[Approval Request Comment]
Bug caused by (feature/regressing bug #): Bug 710330
User impact if declined: Awesomebar will be slightly less awesome
Testing completed (on m-c, etc.): Landed on m-c a while ago, with added tests
Risk to taking this patch (and alternatives if risky): Almost zero
Attachment #641367 - Flags: approval-mozilla-beta?
Attachment #641367 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: